Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Place a "reset form" button using livecycle

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Level 4

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

View solution in original post

0 Replies

Avatar

Correct answer by
Level 4

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

Avatar

Level 4

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.

Avatar

Level 2

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.

Avatar

Level 10

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.

Avatar

Level 1

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();