-
11 Feb 2013 6:59 AM #1
FormPanel submit doesn't work
FormPanel submit doesn't work
I am showing a formPanel in a window and submitting it when upload button is clicked.
On IE9 and Firefox it doesn't do nothing. No request is made.
On Chrome 24...m the request is made correctly but it opens a new tab.
Using GXT 3.0.1 and GWT 2.4.0
I am aware that FormPanel must be attached during submission so I am definitely not hiding the window as shown below. I am curious though if this is already fixed in the latest GXT
Code:import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; import com.sencha.gxt.widget.core.client.container.MarginData; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; import com.sencha.gxt.widget.core.client.form.CheckBox; import com.sencha.gxt.widget.core.client.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.FileUploadField; import com.sencha.gxt.widget.core.client.form.FormPanel; import com.sencha.gxt.widget.core.client.form.FormPanel.Encoding; import com.sencha.gxt.widget.core.client.form.FormPanel.Method; import com.sencha.gxt.widget.core.client.form.TextField; public class UlBfPnl extends ContentPanel { public static class UlBfWnd extends Window { private UlBfPnl innerPnl = new UlBfPnl(); public UlBfWnd() { setPixelSize(400, 180); setModal(true); setResizable(false); setWidget(innerPnl); } public UlBfPnl getInnerPnl() { return innerPnl; } } private FormPanel formPnl; private FileUploadField ulFld; private TextField fileNameFld; private CheckBox medFld; private TextButton ulBtn = new TextButton("Upload"); public UlBfPnl() { setHeaderVisible(false); ulFld = new FileUploadField(); ulFld.setName("u"); fileNameFld = new TextField(); fileNameFld.setName("n"); medFld = new CheckBox(); medFld.setName("med"); VerticalLayoutContainer p = new VerticalLayoutContainer(); p.add(new FieldLabel(ulFld, "Upload File"), new VerticalLayoutData(1, -1)); p.add(new FieldLabel(fileNameFld, "File Name"), new VerticalLayoutData(-1, -1)); p.add(new FieldLabel(medFld, "Medical Form"), new VerticalLayoutData(-1, -1)); formPnl = new FormPanel(); formPnl.setEncoding(Encoding.MULTIPART); formPnl.setMethod(Method.POST); formPnl.setWidget(p); add(p, new MarginData(10)); setButtonAlign(BoxLayoutPack.CENTER); addButton(ulBtn); } public FormPanel getFormPnl() { return formPnl; } public FileUploadField getUlFld() { return ulFld; } public TextButton getUlBtn() { return ulBtn; } public TextField getFileNameFld() { return fileNameFld; } public CheckBox getMedFld() { return medFld; } }Code:dspl = new UlBfWnd(); dspl.getInnerPnl().getFormPnl().setAction(arg0); dspl.getInnerPnl().getUlBtn().addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { dspl.getInnerPnl().getFormPnl().submit(); } });
-
11 Feb 2013 8:20 AM #2
My bad. I made a typo at this line
should be add(formPnl, new MarginData(10));Code:add(p, new MarginData(10));
Please close this bug report.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote