View Full Version : Set Value on form load

30 Oct 2009, 6:34 AM

I'm building some complex forms, where I prepared some predefined components to suit my need.

An example is attached.

Everything marked red is just one component So I can add it to the form just by adding:

xtype: 'PostalCodeChooser'

It is assembled from ComboBox and a textfield. If a value in combo is selected the textfield is set with a proper city value.

The question arises when I load a form. Then the value of textfield is not set, but the value of the combo box is. I know that I could set the value inside success part of the form.load, but the postalCode chooser is used in several places, so I would avoid this if posssible.
Now - my question is - is there any chance to listen somehow on combo box when the value is set and also set the value of the text field?

Is it possible somehow to load the data automatically from the textfield from the combo store, when form is loaded?

Thanks in advance.

30 Oct 2009, 9:54 AM
you can set the textfield to the city value stored on the selected record in the combo's store...

just use the 'select' listener on the combobox

31 Oct 2009, 4:27 AM
But select is not triggered on form.load().