PDA

View Full Version : How to get the HTTP status code for a FormPanel?



johnstok
16 Feb 2009, 7:53 AM
I am using a FormPanel to perform a file upload.

I have set the relevant properties and everything is working ok:

panel.setEncoding(FormPanel.Encoding.MULTIPART);
panel.setMethod(FormPanel.Method.POST);I have an event listener to handle the result of the form submission:

panel.addListener(
Events.Submit,
new Listener<FormEvent>() {
public void handleEvent(final FormEvent be) {
// Use be.resultHtml to report success
}
}
);However, if the upload fails I need to report an error. I would like to set the status code of the HTTP response to be 500 and provide an error report as JSON in the response body.

Does anyone know how I can check the HTTP response code from the FormEvent?

jpnet
16 Feb 2009, 8:50 AM
As far as I know, you can't. I had this same issue awhile back. My workaround was to iterate the form fields and encode them manually, then finally use RequestBuilder.

I would think the GXT team would be able to modify the Form control to allow this functionality.

-JP

gaboo
2 May 2009, 9:28 PM
I have the same problem...

andre_guitar7
28 May 2009, 9:13 AM
Estou com o mesmo problema!