PDA

View Full Version : My extjs3.4 form does not call the specified URL on submit.



kumar_Rajesh78
9 Dec 2013, 9:24 AM
I am trying to submit a form and call the URL on form submit. However, the form gets submitted, but the URL does not get called. What could be the reason.Below is my code. Also if I specified the URL at the form level and not within the handler method, the URL gets called, but the form does not submit.
I am not able to understand this behaviour.



xtype: 'form',
padding: 0,
margin: 0,
border: false,
fileUpload: true,
timeout: 300,
height: 0,
region: 'north',
monitorValid: true,
standardSubmit: true,
id: 'leverageForm2',
fbar: {
xtype: 'toolbar',
buttonAlign: 'center',
id: 'leverageFormToolbar',
items: [
{
xtype: 'button',
text: 'Refresh Report Data',
type: 'submit',
formBind: true,
handler: function() {
Ext.getCmp('leverageForm2').getForm().submit({
url: '/wam-coldfusion/rest/api/simulator/report/refreshReportData',
method:'POST',
waitMsg: 'Submitting for Report Generation ...',
success: function(form) {
},
failure: function(form, action) {
Ext.Msg.alert('Failure', 'Export Unsuccessful!');
}
});
}
}
]
}

kumar_Rajesh78
9 Dec 2013, 2:47 PM
I have not received any reply on my post yet. No one is even trying to view my issue. :(
Could someone please take time to review and give me a direction.
It would be highly appreciated.

Thanks,
Rajesh

Gary Schlosberg
19 Dec 2013, 6:51 AM
So the URL is never called? Do you get anything helpful from the console? Do either the success or failure functions fire?

jbeaven
19 Dec 2013, 8:38 AM
I don't know that this is the case but at first glance I would suspect it's because the handler function doesn't conform to the way Forms are submitted via Ext.

From the docs: "By default, Ext Forms are submitted through Ajax, using Ext.form.Action. To enable normal browser submission of the BasicForm contained in this FormPanel, see the standardSubmit option."

Here's a link to the standardSubmit information: http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.BasicForm-cfg-standardSubmit

kumar_Rajesh78
19 Dec 2013, 9:01 AM
Thats right Gary. The URL never got called and also it never entered into Success or Failure block.
I found a work around it by making an Ajax call explicitly.
But I would have rather wanted it worked in the original form.

Thanks for your response.

kumar_Rajesh78
19 Dec 2013, 9:02 AM
Thanks J.
As you see, I have enable StatndardSubmit to true.
THis should have taken care of the submission.
But it did not do any good unfortunately.

Thanks.
Rajesh

jbeaven
19 Dec 2013, 9:31 AM
As you see, I have enable StatndardSubmit to true.
THis should have taken care of the submission.
But it did not do any good unfortunately.

Hey Rajesh,

I think this might be because you never set the URL config object on the form as per the example in the documentation. Just a thought.

Gary Schlosberg
19 Dec 2013, 12:23 PM
Also being discussed here:
http://www.sencha.com/forum/showthread.php?278289