Expand my Community achievements bar.

Reset confirmation

Avatar

Former Community Member
I am very new to LiveCycle designer. I added a reset button on a form. I want to ask the form filler to answer if he really want to reset the form when he click on the RESET button. How can I do that? Thank you!
2 Replies

Avatar

Former Community Member
You can take the standard Reset button from the library and just modify it slightly. Delete the standard code and use the JavaScript below instead (on the "Click" event). I've done my best to explain each line.



//this variable declares the text that will appear in the Alert Box

var cMsg = "This will permanently clear this form\n\nDo you want to Continue?";



//the declaration below represents the Alert Box type and the

//arguments that will determine appearance and behaviour

var nRtn = app.alert(cMsg,1,2, "Reset Form");



//determine the value of the User's response (i.e. did they

// click "Yes" or "No"?

if(nRtn == 4)

{ // A Yes Answer

// reset data

xfa.host.resetData();



}

endif;