Expand my Community achievements bar.

How to get reset button to clear the required field red boxes on use

Avatar

Former Community Member

I have a reset button in my form.

The javascript is:

form1.BodyPage.ResetButton1::click - (JavaScript, client)
xfa.host.messageBox("Are you sure you want to erase ALL data on this form and start over?")
xfa.host.resetData();
xfa.form.remerge();

I do have several required fields in the form.  The problem is when I use the reset button it clears the form but the red boxes still remain around the required fields.

what can I add to my javascript to accomplish this? This is probably a simple thing but I'm a bit of a noob at this, forgive me.

2 Replies

Avatar

Former Community Member

Not a simple thing (or rather, not an obvious thing). For the text field object defined as "User Entered - Required" you have to set the nullTest property to "".

// form1.page1.subform1.resetBtn::click - (JavaScript, client)


form1.page1.subform1.firstName.validate.nullTest = "";

xfa.host.resetData();

You might consider reseting nullTest to "error" on the text field enter event, if it makes sense for you requirements.

Steve

Avatar

Level 2

Hello Greg

I was wondering if you can help me.

I have 5 Drop Down List fields on a page.  I want to insert a button that when pressed by the user clears (or resets) these 5 fields with out ressetting the whole form.

Can you help