View Full Version : Text Field set valid on function. Need to overwrite Ext invalid state

2 Dec 2011, 8:26 AM
Dear all,

First time posting, but have looked at previous examples and googled a lot so please be kind!

I am trying to reset the contents of a form inside which are some textfields which by default need to have allowBlank: false set on them. When the form contents are set to empty string "" the textfield obviously validates that the content of the textfield is false. I want to set the validation at this point to be overwritten to be true at this state, before continuing with normal behaviour once a user enters data into the box again.

Basically I just need to reset the validation and content of the form back to it's default state before text is entered by the user.

(TextField mentioned)

xtype: 'textfield',
name: 'firstName',
fieldLabel: 'first name',
allowBlank: false // requires a non-empty value

(Section of function mentioned)

var firstNameEntry = Ext.getCmp("firstName");
firstNameEntry.setValid() //TODO ?? I know this is incorrect EXT/JS and am trying to resolve this

2 Dec 2011, 8:36 AM
To clear the invalid state, execute the clearInvalid() method on the field.

2 Dec 2011, 8:38 AM
Thank you very much... quite embarrassed I couldn't find that myself in API's.

Thanks Again