To be more specific, I ran into this problem when trying to submit a form
from a panel that was rendered inside a modal window, but only if the panel
itself was rendered by ajax. In my case, that meant calling
somePanel.replaceWith(TestPanel), and having a form inside TestPanel fail.
 The problem only happens with firefox. I created a TestPanel to demonstrate
the problem. To replicate, you can put this panel inside a modal window and
click submit twice.
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;

/**
 * TestPanel.java
 * If this panel is put inside a modal window, it should break firefox on
the second submit
 *
 */
public class TestPanel extends Panel {

// constructor
public TestPanel(final String id) {
super(id);
setOutputMarkupId(true);
 final Form form = new Form("f");
form.add(new AjaxButton("a") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
Component c = form.getParent();
TestPanel t = new TestPanel(c.getId());
c.replaceWith(t);
target.addComponent(t);
}
});
add(form);
}
}


TestPanel.html:

<html xmlns:wicket>
<wicket:panel>
 Will the second submit error in FF
 <form wicket:id="f">
<input type="submit" value="submit" wicket:id="a"/>
</form>
 </wicket:panel>
</html>


This is what is rendered:

 FIRST RENDER:
 Will the second submit error in FF
 <form id="f23b" method="post"
action="?x=Ujs-j6lQXZBnnVo2YVvBrjA7*96Dtg3BoJNwgV1fwVh0oY*DDl4a42-LLtnecFT3hOa*Lt3BY4dxfIrvlVJg6w"><div
style="display: none;"><input name="f23b_hf_0" id="f23b_hf_0"
type="hidden"></div>
<input value="submit" name="a" id="a23c" onclick="var
wcall=wicketSubmitFormById('f23b',
'?x=Ujs-j6lQXZBnnVo2YVvBrjA7*96Dtg3BoJNwgV1fwVh0oY*DDl4a435szDVJJj4ocOSp5oPS3lx*cNQSCnt70GRKCdS7TsxjzEE65pPiz3d5hXasbKbCjkAQviGteakozDIGY11GEi4flR8kUeR9Hw',
'a' ,null,null, function() {return
Wicket.$$(this)&amp;&amp;Wicket.$$('f23b')}.bind(this));;; return false;"
type="submit">
</form>

SECOND RENDER:
 Will the second submit error in FF
 <div style="display: none;"><input name="f245_hf_0" id="f245_hf_0"
type="hidden"></div>
<input value="submit" name="a" id="a246" onclick="var
wcall=wicketSubmitFormById('f245',
'?x=Ujs-j6lQXZBnnVo2YVvBrjA7*96Dtg3BoJNwgV1fwVh0oY*DDl4a435szDVJJj4ocOSp5oPS3lx*cNQSCnt70GRKCdS7TsxjzEE65pPiz3d5hXasbKbCjkAQviGteakozDIGY11GEi4flR8kUeR9Hw',
'a' ,null,null, function() {return
Wicket.$$(this)&amp;&amp;Wicket.$$('f245')}.bind(this));;; return false;"
type="submit">
</div>

For some reason the <form> tag seems to drop. Also, I dont think this
happened in 1.3. I believe this is the same error someone was describing
here:
http://www.nabble.com/Wicketstuff-releases--td24931965i20.html#a24960539

Reply via email to