- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi,
Method 1:
In the submit button the first line in the click event would call the function:
controller.validateForm(1);
Then I added a hidden field on the form next to the submit button and used this as a flag: "statusFlag".
In the validateForm function you will see a line toward the end of the function that returns false. Above this include the following (reference would need to match your form's hierarchy/naming convention:
form1.page1.statusFlag.rawValue = "0";
Then there is a line where the function returns true. Again put a line above this to change the flag:
form1.page1.statusFlag.rawValue = "1";
Then back to the submit button. Wrap the submit script in an if statement, which looks at the statusFlag value:
if (statusFlag.rawValue == "1")
{
// email script
}
Basic route, submit button calls function; function returns false/true; changes statusFlag value; submit looks at flag and submits if flag is one.
This is how I did it a few years ago when I came across the example. But looking at it again it could be simplified.
Method 2:
You could pass the function to a variable "formStatus", so that you do not need a hidden field AND you would not need to add the lines to the function AND the script in the click event of the submit button would look like this:
var formStatus = controller.validateForm(1);
if (formStatus == "true")
{
// email script
}
Method 2 would be the preferred approach.
Hope that helps,
Niall
Views
Replies
Total Likes