Infopath Alert

L

lanwalker

Step-by-Step
------------
1. Start Infopath 2003.
2. On the File menu, click Design a Form.
3. In the Design a Form task pane, click New Blank Form.
4. To add the following script to your form, follow these steps:
a. On the Tools menu, point to Script, and then select On Load Event.

Microsoft Script Editor appears.
b. Replace the OnLoad function with the following code:

JScript
-------
function XDocument::OnLoad(eventObj)
{
debugger;
XDocument.UI.Alert("This is a test.");
}


VBScript
--------
Sub XDocument_OnLoad(eventObj)
Stop
XDocument.UI.Alert "This is a test."
End Sub

c. Save the script, and then close Script Editor.

5. On the File menu, point to Preview Form, and then click Default.

For more help with infopath programming please contact me at
(e-mail address removed)

Alain Vezina
 
A

Andrew Watt [MVP - InfoPath]

JScript
-------
function XDocument::OnLoad(eventObj)
{
debugger;
XDocument.UI.Alert("This is a test.");
}


VBScript
--------
Sub XDocument_OnLoad(eventObj)
Stop
XDocument.UI.Alert "This is a test."
End Sub

Ian,

If the above code was intended for beginners (as I assume it was)
having the debugger and Stop statements will, I suggest, confuse those
with little familiarity with the Script Editor debugging. Those most
likely to need such simple scripts are also those most likely not to
understand (fully?) how debugging works in the Script Editor.

XDocument.UI.Alert ("This is a test.")

will work in both VBScript and JScript (add a semicolon in JScript, if
you prefer).

Andrew Watt
MVP - InfoPath
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top