Hi Alan,
I see what you mean. What you need is doable though...try following these
steps to see if this gets you to where you need.
- Create a new, blank InfoPath form
- Add a text box and button to the form
- Right-click on the button and choose Properties
- Click the Rules button
- Click Add
- Click Add Action
- From the Action box select: Set a field's value
- Click the button next to the Field box, select field1 and click OK
- Click the "fx" button next to the Value field, click Insert Function and
from the Date and Time category, choose the "now" function and click OK.
(It's really not important what function you choose here but we cannot
directly add what we need into the Designer here. As such, this is merely a
"place holder" so we can easily find this function in the Manifest.XSF when
we open it with Notepad.)
- Click OK 5 times to get back to your form
- Load the script editor
- Add the following function:
function Test()
{
var i = 5;
return i * 10;
}
- Save and close the script editor
- From the File menu choose Extract Form Files and extract these to a
location of your choice
- Close InfoPath
- Locate the extracted files and open Manifest.XSF with Notepad
- Locate the following entry:
expression="xdDate:Now()"
- Change this to:
expression="xdExtension:Test()"
- Add the xdExtension namespace as per the BLOG entry
- Save and close Notepad
- To test, simply double-click Manifest.XSF and click the button - you
should see the value of 50 in the box!
- Assuming this works as expected, you can right-click on Manifest.XSF,
choose Design and then from the File menu choose Save As and save this back
as an XSN file.
So in your scenario Alan, you will need to add rules to set the values of
your fields to some dummy value (i.e. now()) and then change these in the
Manifest as needed.
Let me know how this works for you!
Best regards,
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.