You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marieke Vandamme <ma...@tvh.be> on 2008/10/09 10:54:37 UTC

Ajax:submit formcomponent with ajaxbutton

Hello, 

I think I can explain it best with an example :

TextField txt = new TextField("txt");
WebMarkupContainer btn = new WebMarkupContainer("btn");
btn.add(new AjaxFormComponentUpdatingBehavior("onclick", txt);

=> I want to submit the value of another formcomponent when clicking on the
button. 

I know I can use an AjaxButton or a AjaxFormSubmitBehavior instead, but than
all the fields on my form are submitted, and I only want this one field.
There are a lot of fields on my form, and it's not necessary to submit all
of them and then I have to deal with the validation of my form and so..

Is this possible in any way? Are is it something that can be added to the
AjaxFormComponentUpdatingBehavior class?
Thanks ! Marieke
-- 
View this message in context: http://www.nabble.com/Ajax%3Asubmit-formcomponent-with-ajaxbutton-tp19894923p19894923.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Ajax:submit formcomponent with ajaxbutton

Posted by Marieke Vandamme <ma...@tvh.be>.

That works perfectly indeed.
Always thought that nested forms would break in html, but wicket converts
them to a div indeed. that's so clever. I already told my colleagues, and
it's definitely something we'll use frequently.
Thanks a lot ! 
kind regards, Marieke


Michael Sparer wrote:
> 
> Hi, 
> 
> yes this is possible, you can nest forms in wicket. Just make a form in a
> form in both your markup and your code. As this doesn't conform the html
> standard, wicket will automagically change the second form to a div and
> only submit the inner form. But be careful when submitting the outer form
> ... if I remember correctly, then the inner form gets submitted as
> well.... however I'm not sure about that. 
> 
> regards,
> Michael
> 
> Marieke Vandamme wrote:
>> 
>> Hello, 
>> 
>> I think I can explain it best with an example :
>> 
>> TextField txt = new TextField("txt");
>> WebMarkupContainer btn = new WebMarkupContainer("btn");
>> btn.add(new AjaxFormComponentUpdatingBehavior("onclick", txt);
>> 
>> => I want to submit the value of another formcomponent when clicking on
>> the button. 
>> 
>> I know I can use an AjaxButton or a AjaxFormSubmitBehavior instead, but
>> than all the fields on my form are submitted, and I only want this one
>> field. There are a lot of fields on my form, and it's not necessary to
>> submit all of them and then I have to deal with the validation of my form
>> and so..
>> 
>> Is this possible in any way? Are is it something that can be added to the
>> AjaxFormComponentUpdatingBehavior class?
>> Thanks ! Marieke
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Ajax%3Asubmit-formcomponent-with-ajaxbutton-tp19894923p19897321.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Ajax:submit formcomponent with ajaxbutton

Posted by Michael Sparer <mi...@gmx.at>.
Hi, 

yes this is possible, you can nest forms in wicket. Just make a form in a
form in both your markup and your code. As this doesn't conform the html
standard, wicket will automagically change the second form to a div and only
submit the inner form. But be careful when submitting the outer form ... if
I remember correctly, then the inner form gets submitted as well.... however
I'm not sure about that. 

regards,
Michael

Marieke Vandamme wrote:
> 
> Hello, 
> 
> I think I can explain it best with an example :
> 
> TextField txt = new TextField("txt");
> WebMarkupContainer btn = new WebMarkupContainer("btn");
> btn.add(new AjaxFormComponentUpdatingBehavior("onclick", txt);
> 
> => I want to submit the value of another formcomponent when clicking on
> the button. 
> 
> I know I can use an AjaxButton or a AjaxFormSubmitBehavior instead, but
> than all the fields on my form are submitted, and I only want this one
> field. There are a lot of fields on my form, and it's not necessary to
> submit all of them and then I have to deal with the validation of my form
> and so..
> 
> Is this possible in any way? Are is it something that can be added to the
> AjaxFormComponentUpdatingBehavior class?
> Thanks ! Marieke
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/Ajax%3Asubmit-formcomponent-with-ajaxbutton-tp19894923p19895131.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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