Here is a workaround
http://www.mail-archive.com/users@wicket.apache.org/msg35946.html

**
Martin

2011/1/24 Clément Tamisier <clement.tamis...@gmail.com>:
> Hi, I have something strange with wicket 1.4 and I don't find what.
> I have 2 nested forms. The inner form (form2) is in a modal window, and when
> I validate this form (form2) the checkbox of "main" form (form1) become
> unchecked (which is initially checked).
> to test: click on "click" and submit the form of modal window showed ->
> checkbox become unchecked.
> PS : if I uncheck my checkbox manually and retry, it's works.
> I include this this project in the mail. You can launch it with: "mvn clean
> compile jetty:run"
> Do you have any ideas. Thank you very much.
> Clément
>
> HelloWorld.java
> public class HelloWorld extends WebPage {
> private CheckBox checkbox;
> private ModalWindow modalWindow;
> @SuppressWarnings("serial")
> public HelloWorld() {
> Form<Object> form = new Form<Object>("form1");
> add(new AjaxLink<Object>("click") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> modalWindow.show(target);
> }
> });
> checkbox = new CheckBox("checkbox", new Model<Boolean>(true));
> checkbox.add(new OnChangeAjaxBehavior() {
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> System.out.println("checkbox set to :"+checkbox.getModelObject());
> }
> });
> checkbox.setOutputMarkupId(true);
> modalWindow = new ModalWindow("modal");
> SubmitPanel panel = new SubmitPanel("content", checkbox, modalWindow);
> modalWindow.setContent(panel);
> form.add(checkbox);
> form.add(modalWindow);
> form.add(new AjaxButton("submitForm") {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
> System.out.println("on submit checkbox is :"+checkbox.getModelObject());
> }
> });
> add(form);
> }
> }
>
> HelloWorld.html
> <html>
> <body>
> <form wicket:id="form1">
> <div wicket:id="modal"></div>
> <input type="checkbox" wicket:id="checkbox" />
> <input type="submit" wicket:id="submitForm" />
> </form>
> <a wicket:id="click">click</a>
> </body>
> </html>
>
> SubmitPanel.java
> public class SubmitPanel extends Panel{
> public SubmitPanel(String id, final CheckBox checkbox, final ModalWindow
> modalWindow) {
> super(id);
> Form<Object> form =new Form<Object>("form2");
> form.add(new AjaxButton("submitForm2") {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
> checkbox.setModelObject(true);
> target.addComponent(checkbox);
> modalWindow.close(target);
> }
> });
> add(form);
> }
> }
>
> SubmitPanel.html
> <wicket:panel>
> <form wicket:id="form2">
> <input type="submit" wicket:id="submitForm2" />
> </form>
> </wicket:panel>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to