I Placed a button on a form called "Clear Form" Now what do I do to reset the form when clicked? Can I also add a "Are you sure message" with another ok button?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Brainstewn,
Designer provides a standard button called "RESET BUTTON" that would reset all the fields of a form.
You can place that button and rename the caption as "Clear Form".
Thanks,
VJ
Views
Replies
Total Likes
Hi Brainstewn,
Designer provides a standard button called "RESET BUTTON" that would reset all the fields of a form.
You can place that button and rename the caption as "Clear Form".
Thanks,
VJ
Views
Replies
Total Likes
You can add the following piece of code on the same "RESET BUTTON" for an alert "Are you sure message"..
var answer = xfa.host.messageBox("Are you sure you want to reset the form?","Confirmation Required !!!",2,2);
if(answer == 4)
{
xfa.host.resetData();
}
else
{
xfa.host.cancelAction =1;
}
Thanks,
VJ.
Thank you for the script to create a window. I made a reader extended version to test this form. The clear form button works great, but if I click no on the verfify window, created by your script, it doesn't undo the clear form action or prevent the clear form action.
Views
Replies
Total Likes
Try it without the else statement, it's not needed though I don't think it would be causing the problem. The cancelAction isn't needed because if the answer doesn't equal 4 nothing is going to happen.
And you may want to add xfa.form.remerge(); after xfa.host.resetData(); to reset form elements.
Views
Replies
Total Likes
Thanks for the script. I have a form with radio buttons that make certain fields appear visible/invisible mattering on wheather user chooses yes or no. I used actions to perform the visible/invisible function.
When using your script i get the Yes/no option in a popup and if I choose yes it correctly clears all my rado buttons and also resets any fields.
However the no fuction does not seem to be working. If I choose no it still clears out everything, the radio buttons and resets any fields made visible by said radio buttons. As you suggested I added xfa.form.remerge(); which made the visible fields reset.
Heres the code i used.
var
answer = xfa.host.messageBox("Are you sure you want to reset the form?","Confirmation Required !!!",2,2);
if
(answer ==4)
xfa.host.resetData();
xfa.form.remerge();
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies