PDA

View Full Version : Reset A Form, To Its Current Value Set



joefox
7 Nov 2014, 9:23 AM
I have a form, that when someone makes a change marks the field dirty, and changes the color of the label on the input.

I want to make it so a user can reset the form, turn all dirty fields off, and keep what is currently in the form. So if someone checked, or put something new into a field, they can press a button to reset the form, but NOT back to its original values, but the values that are in entered into the form.

For example, the field labels would all be black, at the start, a user selects or unchecks the 'Mailbox Disabled' box, by default it turns orange as being changed. If a user presses the "reset" button, I want it to reset the form so that its not marked as dirty, and the value of the box, is the actual value checked/unchecked, NOT the original value.

Ive read a few suggestions online, but none seem to work, any ideas?

50939

slemmon
10 Nov 2014, 2:20 PM
Hi,
I believe this is what you're looking for:
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.BasicForm-method-clearInvalid

So you can get a reference to the formpanel and do:

formPanel.getForm().clearInvalid();