Hi,
I created a form, in LifeCycle Designer, with a "Save Form" button which has validation rules in it. However, if I click the File menu and select a save method (Save, Save as, Save As Other), I can save the file and bypass the validation rules, which is not what I want.
Is there a way that I can catch the "save" event in the code behind when it is fired so that I can enforce my validation rules on the form, as I do in the "Save Form" button?
Thanks
Sam
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi Ratnesh,
Thanks so much for the help.
Yes, the preSave does get the event here. Then I have another question related to it: how to STOP saving process after I find the form is invalid?
In my "Save Form" button click event, I do something like following:
if (isValidForm()) {
//set the timestamp...
app.execMenuItem("SaveAs");
}else{
// run code to show the invlid form field...
}
This works as expected: no invalid file will be saved.
While in the preSave event, I removed the app.execMenuItem("SaveAs"); simply it will open a "Save as" window again. Now I have the follwoing code:
if (isValidForm()) {
//set the timestamp... and save
}else{
// run code to show the invlid form field...
}
When I tested to save an invalid form with "Save" from the File menu, it did catch the invlid field and run code to show invalid field in preSave event. However, the invalid form was still saved. What code I should use to stop it from saving process?
Thanks
Sam
Views
Replies
Total Likes
There is no code to prevent the user from saving. You can however remove any invalid data before the save occurs.
Kyle
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies