0
votes

I have a combobox populated by Json and a function to enable/disable a textfield based on the value selected in the combobox. I registered the listeners as follow:

var cmbTipoDocumento = Ext.getCmp("frmCandidato_cmbTipoDocumento");
cmbTipoDocumento.on('afterrender',selecionarTipoDocumento);
cmbTipoDocumento.on('select',selecionarTipoDocumento);
cmbTipoDocumento.on('blur',selecionarTipoDocumento);

That is working fine when I manually select an item in the combobox, but when the value is loaded with the form it doesn't work. For example, I have 3 items in the combobox: 'One', 'Other', 'Another'. When I select 'Another' I want to enable a textfield so that the user can specify a detail. When I select it by hand everything goes OK. But when I open a record that has 'Another' selected in the combobox the textfield still disabled.

I've debugged the function and notice that it is called when the form is open (combobox afterrender), but at this moment the value of the combobox is empty. I've tried to call the function on the form's 'afterrender' event and on some other events, but the results are the same.

Any tip?

Thank you!

1
does it work as expected if you place the listener on 'change' instead of 'blur'?Amol Katdare
No. I've tried the event 'change' as well. The result remain the same. ThanksLucious

1 Answers

0
votes

in javascript you use the 'change' event to detect when a value has been set:

maybe try:

cmbTipoDocumento.on('change',selecionarTipoDocumento);