Ciao a tutti.
Mi hanno passato un progetto di un sito in cui la componente javascript e' scritta con le librerie ExtJs (almeno credo si chiamino cosi' da quello che ho trovato su internet)
Non avendole mai usate prima sto avendo qualche difficolta'.
In particolare vorrei trasformare un Ext.FormPanel in modo che faccia un submit automaticamente invece che farlo alla pressione di un bottone come aveniva prima.
Ho implementato l'Ext.FormPanel nel seguente modo:
codice:
var login = new Ext.FormPanel({
labelWidth:80,
//url:'login.asp',
frame:true,
title:'Welcome in TiMed, confirm access?',
defaultType:'textfield',
monitorValid:true,
items:[TFlogin = new Ext.form.TextField({
fieldLabel: '',
boxLabel:'',
name:'UN',
hidden: true
})],
listeners: {
beforeactivate:function(){
Ext.Msg.alert('beforeactivate start');
login.getForm().submit({
method:'POST',
url: 'loginssl.php',
success:function(){
if (login.getValue == 'doctor') {
PrescriptionsListingEditorGrid.getTopToolbar().show();
AnamnesiListingEditorGrid.getTopToolbar().show();
AllergiesListingEditorGrid.getTopToolbar().show();
westPanel.expand();
}
else if (login.getValue() == 'patient') {
westPanel.collapse();
fs.remove(newButton);
submitButton.enable();
AnamnesiListingEditorGrid.getTopToolbar().hide();
AllergiesListingEditorGrid.getTopToolbar().hide();
PrescriptionsListingEditorGrid.getTopToolbar().hide();
userID = 1;
fs.getForm().load
({
url: hostServer+'/TiMed/healthcare/db_test.php',
waitMsg: 'Loading',
params: { //these will be available via $_POST or $_REQUEST:
task: "LISTING",//pass task to do to the server script
id: userID,
table: 'personaldata'
}
})
fs2.getForm().load //ContactsDataStore.load()
({
url: hostServer+'/TiMed/healthcare/db_test.php',
waitMsg: 'Loading',
params: { //these will be available via $_POST or $_REQUEST:
task: "LISTING",//pass task to do to the server script
id: userID,
table: 'medicalinfo'
}
})
PrescriptionsDataStore.load({
params: {
id: userID
}
})
PrescriptionsDataStore.groupBy('date');
AnamnesiDataStore.load({
params: { //these will be available via $_POST or $_REQUEST:
id: userID
}
})
AnamnesiDataStore.groupBy('state');
} else if (login.getValue() == 'drugstore') {
westPanel.expand();
fs.remove(newButton);
fs.remove(submitButton);
fs2.remove(submitButton2);
AnamnesiListingEditorGrid.getTopToolbar().hide();
PrescriptionsListingEditorGrid.getTopToolbar().hide();
AllergiesListingEditorGrid.getTopToolbar().hide();
}
win.hide();
center.show();
viewport.doLayout();
},
failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Login Failed!', obj.errors.reason);
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);
}
login.getForm().reset();
}
});
}
}
});
sperando che la funzione associata al listener 'beforeactivate' facesse partire automaticamente il submit ma questo non accade e l'alert Ext.Msg.alert('beforeactivate start'); non compare quindi immagino che non entri nemmeno in quella funzione.
Dove sbaglio?
ciao e grazie
Sandro