I'm using an AjaxTabbedPanel and I would like to obtain the following behaviours:

1) user input must be retained when switching tabs

2) tabs link should skip only the "requireness" validation but not all other validators so the user can switch from tab to tab if he doesn't insert bad input

3) a submit button present in all tabs should execute a full validation of the TabbedPanel (all tabs) before execute some logic on the user input


Actually I've solved the point 1 overriding the AjaxTabbedPanel#newLink returning an AjaxSubmitLink instead the AjaxFallbackLink.
What is the best way to solve the other two open points?

Thank you

The relevant code of my WebPage follow:

||

public TabbedPanelPage() {
final Form form = new Form("formy", new CompoundPropertyModel(this));
       form.setOutputMarkupId(true);
       add(form);

       final FeedbackPanel fp = new FeedbackPanel("feedback");
       fp.setOutputMarkupId(true);
       add(fp);

        List tabs = new ArrayList();
        tabs.add(new AbstractTab(new Model("first tab")) {
            public Panel getPanel(String panelId) {
                Panel p = new TabPanel1(panelId, form.getModel());
                firstNameText = new TextField("text1");
                firstNameText.setOutputMarkupId(true);
                firstNameText.add(new 
StringValidator.MinimumLengthValidator(2));
                p.add(firstNameText);
                return p;
            }
        });
tabs.add(new AbstractTab(new Model("second tab")) {
            public Panel getPanel(String panelId) {
                Panel p = new TabPanel2(panelId, form.getModel());
                lastNameText = new TextField("text2");
                lastNameText.add(new StringValidator.MinimumLengthValidator(2));
                p.add(lastNameText);
                return p;
            }
}); tabPanel = new AjaxTabbedPanel("tabs", tabs) {
            @Override
            protected WebMarkupContainer newLink(String linkId, final int 
index) {
return new AjaxSubmitLink(linkId, form) {
                    private static final long serialVersionUID = 1L;
@Override
                    protected void onSubmit(AjaxRequestTarget target, Form 
form) {
                        setSelectedTab(index);
                        if (target != null) {
                            target.addComponent(form);
                        }
                        onAjaxUpdate(target);
                    }
@Override
                    protected void onError(AjaxRequestTarget target, Form form){
                        target.addComponent(fp);
                    }
                }.setDefaultFormProcessing(true);
            }
        };
        form.add(tabPanel);
Button submit = new Button("submit_button") {
            @Override
            public void onSubmit() {
// TODO - validate entire form and process data
            }
        };
        form.add(submit);
   }





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

Reply via email to