check that checkboxes still work correctly since browser doesnt send
anything (not even the name) when they are unchecked.

-igor

On Mon, Jan 24, 2011 at 11:45 AM, Pedro Santos <[email protected]> wrote:
> Linking the thread with the existing ticket:
> https://issues.apache.org/jira/browse/WICKET-1826
> <https://issues.apache.org/jira/browse/WICKET-1826>I attached the described
> patch in it.
>
> On Mon, Jan 24, 2011 at 5:30 PM, Pedro Santos <[email protected]> wrote:
>
>> At the linked thread Matej wrote about serialize the parent form of the
>> modal inner form on its submit. I think it would end up sending unnecessary
>> data back to server, since it is quite safe assume that user did not change
>> anything outside the modal window.
>>
>> The FormComponent#inputChanged method are assuming that if the form
>> component is nullable it can live with the nullified rawInput. But it is not
>> true, it would be better assume when form input name is not set in request
>> parameters that there is no raw input. I tested this change on 1.4, fix the
>> quickstart and all tests on the wicket 1.4.
>>
>> I'll give this change more test, but if you already know an potential
>> problem on it give me a tip.
>>
>>
>> ---------- Forwarded message ----------
>> From: Martin Makundi <[email protected]>
>> Date: Mon, Jan 24, 2011 at 3:31 AM
>> Subject: Re: wicket nested form and modal
>> To: [email protected]
>>
>>
>> Here is a workaround
>> http://www.mail-archive.com/[email protected]/msg35946.html
>>
>> **
>> Martin
>>
>> 2011/1/24 Clément Tamisier <[email protected]>:
>> > 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: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Reply via email to