Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

What is function to reset all the fields?

Avatar

Level 4

Hello Guys!

I have 2 page. At the page 1 there is one button. When somebody on click in this button, I want to reset all the fields of the page 2, Is it possible? What the function?

Than you so much!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Yes you use the same command and pass the fields or subforms that you want to have reset as a comma separate string. So if you wanted to reset TextField1, TextField2 and subform1 you woudl use the command:

xfa.host.resetData("TextField1", "TextField2", "subform1")

If you do not pass anything then the whole form is reset.

paul

View solution in original post

4 Replies

Avatar

Level 9

Hello Rafael ,

You can directly use the Reset button from the object library if you want to reset the whole form data . If you want to be more specific then you can use the following script according to your need .

xfa.host.resetData("form1.Page1"); You can use in a click event on a button in JavaScript .

Hope it helps .

Thanks .

Bibhu .

Avatar

Level 4

Is possible I reset just some fields?

Avatar

Correct answer by
Former Community Member

Yes you use the same command and pass the fields or subforms that you want to have reset as a comma separate string. So if you wanted to reset TextField1, TextField2 and subform1 you woudl use the command:

xfa.host.resetData("TextField1", "TextField2", "subform1")

If you do not pass anything then the whole form is reset.

paul

Avatar

Level 4

It worked guys!

Thanks so much for all!

I donated points for all here! Thank you!

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] ----