Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
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
Former Community Member

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

5 Replies

Avatar

Correct answer by
Former Community Member

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

Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----