Question about multiple AjaxSubmitLinks in one form

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about multiple AjaxSubmitLinks in one form

rc.china
Suppose that I have one form which has two parts: each part has an AjaxSubmitLink and some other input components(such as TextField, CheckBox,...):
[code]
public class MyPage extends WebPage {
public MyPage()
{
        Form form = new Form(...);
        add(form);
       
        //Part1
        AjaxSubmitLink link1 = new AjaxSubmitLink(...)
        TextField comp11 = new TextField(...)
        CheckBox comp12 = new CheckBox(...)
        ListChoice comp1n = new ListChoice(...)
        form.add(link1);
        form.add(comp11);
        form.add(comp12);
        form.add(comp1n);
       
       
        //Part2
        AjaxSubmitLink link2 = new AjaxSubmitLink(...)
        TextField comp21 = new TextField(...)
        CheckBox comp22 = new CheckBox(...)
        ListChoice comp2n = new ListChoice(...)
        form.add(link2);
        form.add(comp21);
        form.add(comp22);
        form.add(comp2n);
}
}
[/code]

MyQuestion: when I click (AjaxSubmitLink link1) of Part1, I want to prevent Part2 to submit their data( and their backend Model object). What can I do ?
Reply | Threaded
Open this post in threaded view
|

Re: Question about multiple AjaxSubmitLinks in one form

Eelco Hillenius
> Suppose that I have one form which has two parts: each part has an
> AjaxSubmitLink and some other input components(such as TextField,
> CheckBox,...):
> [code]
> public class MyPage extends WebPage {
> public MyPage()
> {
>         Form form = new Form(...);
>         add(form);
>
>         //Part1
>         AjaxSubmitLink link1 = new AjaxSubmitLink(...)
>         TextField comp11 = new TextField(...)
>         CheckBox comp12 = new CheckBox(...)
>         ListChoice comp1n = new ListChoice(...)
>         form.add(link1);
>         form.add(comp11);
>         form.add(comp12);
>         form.add(comp1n);
>
>
>         //Part2
>         AjaxSubmitLink link2 = new AjaxSubmitLink(...)
>         TextField comp21 = new TextField(...)
>         CheckBox comp22 = new CheckBox(...)
>         ListChoice comp2n = new ListChoice(...)
>         form.add(link2);
>         form.add(comp21);
>         form.add(comp22);
>         form.add(comp2n);
> }
> }
> [/code]
>
> MyQuestion: when I click (AjaxSubmitLink link1) of Part1, I want to prevent
> Part2 to submit their data( and their backend Model object). What can I do ?

I can imagine multiple ways to do this, but the most robust way is
probably to just accept submissions but make your model(s) smart
enough to make the distinction.

Eelco

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions.
_______________________________________________
Wicket-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wicket-user