PDA

View Full Version : How to query a form with values insesitive.



tsuryap
5 Oct 2015, 1:14 AM
Hi I have form which have three fields.


Ext.onReady(function(){Ext.create('Ext.form.Panel', {
title: 'Simple Form',
bodyPadding: 5,
layout: 'anchor',
defaults: {
anchor: '100%'
},
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
name: 'first',
value:'test',
allowBlank: false
},{
fieldLabel: 'Last Name',
name: 'last',
value:'test',
allowBlank: false
},
{
fieldLabel: 'end Name',
name: 'end',
value:'Test',
allowBlank: false
}],
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Submit',
formBind: true,
disabled: true,
handler: function() {
var form = this.up('form');
console.log(form.query('field[value*=test]'));

}
}],
renderTo: Ext.getBody()
});


});



when i try to query the form with value test I am getting only two fields. How to get the third field which have value Test. How to ignore case sensivtive while querying the form

joel.watson
5 Oct 2015, 2:25 PM
Hi--

You could use a regex:


form.query('field[value/="[tT]est"]')

or even create your own pseudo-class:

http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.ComponentQuery

Thanks!
Joel