PDA

View Full Version : Stuck: My form wan't to submit



dprocakan
20 May 2007, 7:44 PM
I have a multicolumn form, copied from samples, and modified, It doesn't want to submit, here's the code.


Ext.onReady(function()
{
encryptForm = new Ext.form.Form({
labelAlign: 'top',
labelWidth: 75,
buttonAlign: 'right'
});

encryptForm.column({width:252, labelWidth:75}); // open column, without auto close
encryptForm.fieldset(
{legend:'Encryption Info'},
new Ext.form.TextArea({
fieldLabel: 'Text',
name: 'text',
height: 140,
allowBlank:false
}),

new Ext.form.TextField({
fieldLabel: 'Password',
name: 'password',
inputType: 'password'
})
);

encryptForm.end(); // closes the last container element (column, layout, fieldset, etc) and moves up 1 level in the stack

encryptForm.column({width:252, height:455, style:'margin-left:10px', clear:true});
encryptForm.fieldset(
{legend:'Encryption Info'},
new Ext.form.TextArea({
fieldLabel: 'TextColumn',
name: 'text_column',
height: 140,
allowBlank:false
}),

new Ext.form.TextField({
fieldLabel: 'PasswordColumn',
name: 'password_column',
inputType: 'password'
})
);
encryptForm.end();
encryptForm.end(); // close the column
encryptForm.applyIfToFields({
width:230
});
var encryptButton = encryptForm.addButton('Encrypt');
encryptButton.on('click', onClick);
encryptForm.render("form-ct4");
});

onClick = function()
{
encryptForm.submit({
url:'debug.php',
method:'post',
waitMsg:'Loading',
success:function(form, action, o)
{
alert("Success");
},
failure:function(form, action)
{
alert("Failure");
}
});
}


the file, debug.php isn't being executed, but I wrote everything correct, because when I change submit to load it works.

The result of it is execution of failure handler function, but the form isn't being submited to debug.php.

Any ideas?

rgrdz Harut.

hyankov
22 May 2007, 12:57 PM
I am not sure if this matters, but maybe it should be method: 'POST' instead of method: 'post', (capital letters). Also, why do you have 3 parameters for success?

jsakalos
22 May 2007, 7:34 PM
I am not sure if this matters, but maybe it should be method: 'POST' instead of method: 'post', (capital letters). Also, why do you have 3 parameters for success?

Case of letters of method does not matter. I always use small and it works. Also, the only 2 arguments in the success handler wouldn't cause the execution of failure code.

So what's advice? Search the forum for success+true. The matter has been discussed many times.

hyankov
22 May 2007, 9:16 PM
dprocakan, are you using FF or IE? If FF, do you have the Firebug? You can see what actually is happening with the request there. By the way, try this:


encryptForm = new Ext.form.Form({
labelAlign: 'top',
labelWidth: 75,
buttonAlign: 'right',
method: 'POST'
});

Just my 1.99 cents...