I want to use ExtJS to check the form variant, and the form id within my frontend page is regform, like that....
JSP code
Code:
........
<script type="text/javascript" src="../extbase/checkform.js"></script>
........
<form method="post" action="" id="regform">
<table width="400" border="0" cellpadding="0" cellspacing="0" class="formLook">
<tr class="formbar">
<td>Administrator Login </td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100"> </td>
<td> </td>
</tr>
<tr>
<td width="100"><div align="right">Login Name:</div></td>
<td><input name="adminName" type="text" id="adminName"></td>
</tr>
<tr>
<td width="100"><div align="right">Password:</div></td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="100"> </td>
<td><div id="regbutton"></div></td>
</tr>
<tr>
<td width="100"> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</form>
checkform.js
Code:
var fm2 = new Ext.form.BasicForm('regform');
fm2.add(new Ext.form.TextField({
allowBlank: false,
blankText:'Login Name could not empty'
}).applyTo('adminName'));
fm2.add(new Ext.form.TextField({
allowBlank: false,
blankText:'Password could not empty'
}).applyTo(Ext.get('password')));
Ext.get('regform').un("submit", fm2.onSubmit, fm2);
var regButton = new Ext.Button('regbutton', {
text: 'Login',
handler: function(){
if (fm2.isValid()) {
Ext.Msg.show({
title:'Confirmation',
modal : false,
msg: 'All data are right?',
buttons: Ext.Msg.OKCANCEL,
fn: function(btn, text){
if (btn == 'ok'){
fm2.submit({
url: 'Register.htm',
params: {
oper: 'submit'
},
msgethod: 'POST',
waitMsg:'Please wait....'
});
}
},
animEl: 'regbutton'
}).getDialog().moveTo(200, 100);
} else {
Ext.Msg.show({
title:'System Message',
msg: 'Please fill in all field',
modal : false,
buttons: Ext.Msg.OK
}).getDialog().moveTo(200, 100);
}
}
});
fm2.on({
beforeaction: function(form, action){
regButton.disable();
},
actioncomplete: function(form, action){
if(action.type == 'submit'){
regButton.enable();
}
if(action.result.success){
Cookies.set('Allcard_userName', Ext.get('CustomerName').dom.value);
Ext.Msg.show({
title:'Success',
msg: 'Login Success',
modal : false,
fn: showResult,
buttons: Ext.Msg.OK
}).getDialog().moveTo(200, 100);
}
else{
Ext.Msg.show({
title:'Alert',
msg: 'Login Fail',
modal : false,
buttons: Ext.Msg.OK
}).getDialog().moveTo(200, 100);
}
},
actionfailed: function(form, action){
regButton.enable();
}
});
Those code are reference from another web site, but buttons cannot show, also an error message show in firebugs panel as below.....
Code:
this.el has no properties
BasicForm("regform")ext-all.js (line 133)
BasicForm("regform", undefined)ext-all.js (line 133)
[Break on this error] Ext.form.BasicForm=function(B,A){Ext.apply(this,A);this.items=new Ext.util.Mixed...
I'd search information about the error message within ExtJS forum..... but just can found something about "bugs", can someone help me......?
Thank you!