Code:
Ext.onReady(function(){
Ext.QuickTips.init();
var newadmin = new Ext.FormPanel({
labelWidth: 150, // label settings here cascade unless overridden
labelAlign: 'right',
//url:'newadmin.jsp',
frame:true,
title: 'Register as Administrator',
bodyStyle:'padding:5px 5px 0',
width: 600,
defaults: {width: 312},
defaultType: 'textfield',
items: [{
fieldLabel: 'Administrator Name',
name: 'adminName',
id: 'adminName',
allowBlank:false
},{
fieldLabel: 'Password',
inputType: 'password',
name: 'passwd',
allowBlank:false
},{
fieldLabel: 'Confirm Password',
inputType: 'password',
name: 'password_cf',
validator: vailda,
invalidText: ' Confirm password not equal to password',
allowBlank:false
},{
fieldLabel: 'Email',
name: 'emailadr',
vtype:'email'
}],
buttons: [{
text: 'Register',
if(items.isValid()){
handler:doSave
},
id:'btnSave'
},{
text: 'reset',
handler: function() {
newadmin.form.reset();
}
}]
});
function vailda()
{
if(Ext.get('passwd').dom.value==Ext.get('password_cf').dom.value)
return true;
else
return false;
}
function doSave(){
Ext.MessageBox.show({
msg: 'Data saving, please wait',
progressText: 'Saving',
width:300,
wait:true,
waitConfig: {interval:200},
icon:'ext-mb-save',
nimEl: 'btnSave'
});
newadmin.getForm().submit({
url:'newadmin_i.jsp',
method:'POST',
success: function(form, action){
Ext.MessageBox.hide();
Ext.MessageBox.alert('System Message', 'Data save success');
//newwin.hide();
//ds.load();
},
failure: function(form, action){
Ext.MessageBox.hide();
Ext.MessageBox.show({
title:'Error',
msg: 'Data save failure',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
}
})
};
newadmin.render("newadmin");
Ext.getDom("adminName").focus();
});
error message