


I have a procedure I want a form to do every time the user enters any field. There are a lot of fields, and the code is moderately long, so I'd prefer to not repeat the code in every enter event for every field. Is there a way to define a function or a script that I can call?
This will not only reduce my file size (which is already larger than I'd like), but also obviously help me keep things simple if I need to revise or fix this script in the future.
Thanks
Views
Replies
Sign in to like this content
Total Likes
You can create a script object by right-clicking in the hierarchy and selecting 'Insert Script Object'. Then rename the script object to something useful like masterScriptObject. You can then put your code in there e.g. function myFunction(){...insert code...}. Then you call the function from the fields like this:
masterScriptObject.myFunction();
You can call the function from any event you like.
Hope this helps you.
Views
Replies
Sign in to like this content
Total Likes
You can create a script object by right-clicking in the hierarchy and selecting 'Insert Script Object'. Then rename the script object to something useful like masterScriptObject. You can then put your code in there e.g. function myFunction(){...insert code...}. Then you call the function from the fields like this:
masterScriptObject.myFunction();
You can call the function from any event you like.
Hope this helps you.
Views
Replies
Sign in to like this content
Total Likes
That worked great!
For those of you trying this out, I might save you a few minutes of scratching your head (if you're as slow as I am) by telling you to make sure that you have the script where you call the function set to JavaScript instead of FormCalc. Kept throwing me errors.
And the function script will have to be in JavaScript. It doesn't give me FormCalc as an option. Was not a problem for me--just took a minute or two to convert.
Thanks. Big help.
Views
Replies
Sign in to like this content
Total Likes