PDA

View Full Version : Accessing form items



new2extjs
23 Mar 2012, 2:59 AM
Is it possible to access form items on the basis of " fieldLabel"? (coz name and id can be dynamic)

dedoz
23 Mar 2012, 4:12 AM
you can use component querys to get pretty much any component by any property.
lets say you have field with fieldLabel = "someString"
so you can do this


var field = myForm.query("[fieldLabel='someString']")[0];


the [0] is because query() method returns all component that matched the search, so if theres more than one field with the same label it returns all, if you are sure you only haev one component with that label, just add and [0] to get the first element of the returned array.

new2extjs
23 Mar 2012, 6:18 AM
Thanks :)