Omar Faruq
Omar Faruq

Reputation: 1220

extjs4.1 form reset with exclude some property

I can reset a form by this way

   var form = Ext.getCmp('formId');
        form.getForm().reset();

but i want to reset my form exclude one textfield.

This textField name is 'name'.

form.getForm().reset().exclude('name');

Is it possible.

Anyone help me

Upvotes: 1

Views: 1601

Answers (1)

Molecular Man
Molecular Man

Reputation: 22386

Every form field has reset method. So you can query for all fields but the "name" one and perform reset on each queried field:

// the following query will search for all form fields
// and will exclude fields that have field name set to "name"
var fields = form.query('[isFormField][name!="name"]');

for (var i = 0, len = fields.length; i < len; i++) {
    fields[i].reset();
}

Check out demo.

Upvotes: 4

Related Questions