PDA

View Full Version : Ext.Form Submit Not Working IE 6 or 7



balakk
3 Jul 2007, 12:29 PM
Has anyone else seen this error, I have checked for commas and such I just can't find the reason for the IE error. It only happens in IE 6/7 not in FF ?? I have searched the forums but no resolution.

Line :36
Char: 1477
Error:Syntax error
This line of code is some kind of JSON parser in EXT per the script debugger???

Could this have anything to do with the server response which I am not doing anything with must I always read the response?

I am using a simple dialog and I swap out the from with a update "submitChangePass" is the submit btn handler.

this is all inside the Ext.onReady



function changePass(){
addDialog.showDialog('Change Password',340,75,submitChangePass);
Ext.get('add-form').update();
changePassFrm = new Ext.form.Form({
labelWidth: 125
,url:'/admin/ajax.php'
,method:'get'
,baseParams:{'member_id':member_id
,'ajaxFrm':'changePassword'}
});
changePassFrm.add(
new Ext.form.TextField({
id:'new-pass',
fieldLabel: 'New Password',
name: 'new_password',
inputType: 'password',
width:200
}),

new Ext.form.TextField({
id:'confirm-pass',
fieldLabel: 'Confirm',
name: 'confirm_password',
inputType: 'password',
width:200
})
);
changePassFrm.reset();
changePassFrm.render('add-form');


}
function submitChangePass(){
// the does form vaildation and then submits the form and closes a dialog
changePassFrm.submit();
addDialog.closeDialog();

}

balakk
3 Jul 2007, 1:14 PM
Ok pure trial and error and found a fix..

I added: ",action:'/admin/ajax.php'" to my baseParams and it works

Animal
3 Jul 2007, 11:55 PM
That doesn't sound right. The baseParams are just parameters that are passed to the server, not Form config options. The server will now be recieving an extra HTTP parameter call "action".

Use ext-all-debug.js instead of ext.js. It has uncompressed code so you can see what the error line is doing more clearly.

Ext.form.Form submissions require a valid Json response.

balakk
4 Jul 2007, 9:25 AM
The Error now say's Line 6003

which is this


return eval("(" + json + ')');

Does this help?

tryanDLS
4 Jul 2007, 10:20 AM
Look at the JSON you're returning. eval can only fail if you returned a badly formed string.

balakk
4 Jul 2007, 10:46 AM
I will, Thanks, That is what asking in the beginning :D

"Could this have anything to do with the server response which I am not doing anything with must I always read the response?"

Animal
4 Jul 2007, 11:48 PM
You must return Json that looks like



{success:<true/false>, errors: {fieldName:"Error message"...}}

balakk
5 Jul 2007, 8:23 AM
Yup that was it thanks