PDA

View Full Version : Problem with handlers in a wizard



DJ JJ
19 Jan 2011, 9:45 AM
I implemented a wizard with the Designer. Now I'm managing the navigation through cards. I've attached some handlers that enable the next button when a textfield in the form is fill (it is actived on keyup event). The navigation from the first to the second card works fine. In the second card, I have another textfield that must be fill for enabling the next button, but this time the keyup event is not fired (the function pressione1 is not launched). It is strange, because the code seems to me correct. Can you help me??



nuovaconndb = Ext.extend(nuovaconndbUi, {
initComponent: function() {
nuovaconndb.superclass.initComponent.call(this);
this.btnNext.on('click', this.onConfirmBtnNext, this);
this.btnBack.on('click', this.onConfirmBtnBack, this);
this.btnCancel.on('click', this.onConfirmBtnCancel, this);
this.nomeconndb.on('keyup', this.pressione, this);
this.hostdb.on('keypress', this.pressione1, this);
this.portatcpip.on('keyup', this.pressione1, this);
this.nomedb.on('keyup', this.pressione1, this);
}

,pressione: function(){
var val=this.nomeconndb.getValue();
if(val)
this.btnNext.setDisabled(false);
else
this.btnNext.setDisabled(true);
}

,pressione1: function(){
alert('rrrr');
var val1=this.hostdb.getValue();
var val2=this.portatcpip.getValue();
var val3=this.nomedb.getValue();
if(val1 && val2 && val3)
this.btnNext.setDisabled(false);
else
this.btnNext.setDisabled(true);
}

,onConfirmBtnNext: function(){
var l = Ext.getCmp('nuovaconndb').getLayout();
var i = l.activeItem.id.split('card-')[1];
switch(i){
case '1':
var scelta=this.typeconn.getValue();
switch(scelta){
case 'Native (JDBC)':
l.setActiveItem(1);
break;
case 'ODBC':
l.setActiveItem(2);
break;
case 'OCI':
l.setActiveItem(4);
break;
case 'JNDI':
l.setActiveItem(3);

this.hostdb.setValue('123');
alert(this.hostdb.getValue());

this.portatcpip.setValue('123');
alert(this.portatcpip.getValue());

this.portatcpip.validate();
this.portatcpip.update();


break;
}
this.btnNext.setDisabled(true);
this.btnBack.setDisabled(false);
break;
case '2':
l.setActiveItem(6);
this.btnNext.setDisabled(false);
break;
case '3':
break;
case '4':
break;
case '5':
break;
case '6':
break;
case '7':
break;

}
}

,onConfirmBtnCancel: function() {
this.close();
}
});