Hi, I'm working again on this. And I realized that I have a problem with
this method.

The problem is when I submit the form that adds items, the main form does't
keep its state. I mean if I a complete something like 'name' then click
'add item' the name desapear because it is not submitted.

Do you understand my problem?

But if I nest forms it works but the problem are validations on main form
when inner form is submitted.

Thanks in advance

Tito

On Tue, Dec 20, 2011 at 8:38 AM, Tito <[email protected]> wrote:

> Great!!
> It works ok!
>
> Thank you very much.
>
> On Tue, Dec 20, 2011 at 6:21 AM, Andrea Del Bene <[email protected]>wrote:
>
>> This should not be a big deal. Wicket lets you put form submitting button
>> outside form itself. All you have to do to make it work is to pass the form
>> to component's constructor.
>>
>>
>> HTML code:
>>
>>
>> <form wicket:id="form1">
>>
>> </form>
>>
>> <form wicket:id="form2">
>> <input  type="submit" value="form2" wicket:id="submit2"/>
>>
>> </form>
>>
>> <input type="submit" value="form1"  wicket:id="submit1"/>
>>
>>
>> Java code:
>>
>>
>>
>> add(form1 = new Form("form1"){
>>           @Override
>>        protected void onSubmit() {
>>            super.onSubmit();
>>            System.out.println("form1");
>>        }
>>       });
>>
>>    add(new SubmitLink("submit1", form1));
>>
>>    Form form2;
>>
>>    add(form2 =new Form("form2"){
>>            @Override
>>            protected void onSubmit() {
>>                super.onSubmit();
>>                System.out.println("form2");
>>            }
>>       });
>>
>>    form2.add(new SubmitLink("submit2"));
>>
>>
>>
>> Button "submit1" is outside its form and you have two separated form.
>>
>>
>>
>>  I think you are right.
>>> Using an AjaxButton it works a litle more like I want.
>>>
>>> Nevertheless I still have a problem, because outer form submits inner
>>> form.
>>>
>>> In my case I think that I need two separated forms, but the problem is
>>> how
>>> to put add button y save button in the correct place. I mean, the layout
>>> is
>>> what you mentioned but the behavior is more like two separated forms.
>>> Thank you!
>>>
>>> On Mon, Dec 19, 2011 at 2:04 PM, Andrea Del Bene<[email protected]>*
>>> *wrote:
>>>
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org<[email protected]>
>> For additional commands, e-mail: [email protected]
>>
>>
>

Reply via email to