PDA

View Full Version : Question regarding event bindings



alejandroNNU
5 Mar 2014, 3:06 PM
I have a form panel with several text fields and each of these fields has a 'change' event binding so that whenever it's value changes, it runs a function to determine if the value entered in all fields is valid and thus enables a button that allows the user to continue to the next form. My question is, instead of having to use an event binding for each of these fields which all call the same code, is there some sort of event for the form panel itself so that whenever the value of one of it's components (in this case, one of it's text fields) changes, it can fire off the event and that way I only have to call the function from there instead of having to repeat code? I looked through the documentation but I didn't see any events that would allow me to do this. If there isn't an event, how else would I be able to achieve this? any help would be great.

evant
5 Mar 2014, 3:23 PM
Not exactly. The form fires events for validity/dirty change, but not when any value changes:

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.Basic

That would be a starting point for where to look.

brian428
5 Mar 2014, 6:58 PM
You probably want formBind: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.Panel-cfg-formBind

Also: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.Panel-event-validitychange