when dealing with tabs inside a form there are two options you can go with:

a) the easiest is to use javascript tabs and have the entire form on a
single html page. this works best imho.
b) put the tabbed panel into a form, replace tabbed panel's links with
submitlinks so switching tabs submits the form and persists the values
across requests.

-igor

On Wed, Oct 7, 2009 at 2:43 AM,  <jerr...@sohu.com> wrote:
> There are 3 tabs in a tabbedpanel, a TextField component is in the first tab, 
> and several form components in the other tabs for user input. I added a save 
> button in the tabbedpanel(instead add 3 buttons in each tab, because I just 
> want to save all user inputs by one click), my question is, how to get the 
> TextField value whick is belonged to the first tab when click on the save 
> button.
>
> Html Code:
>                <div wicket:id="tabs">[tabbed panel will be here]</div>
>                <form wicket:id="form">
>                        <input wicket:id="buttonsave" type="submit" 
> value="Submit" />
>                </form>
> Java Code:
>                final List<ITab> tabs = new ArrayList<ITab>();
>                tabs.add(new AbstractTab(new Model<String>("tab1"))
>                {
>                       �...@override
>                        public Panel getPanel(String panelId)
>                        {
>                                return new TaskCreateTabPanel1(panelId);
>                        }
>                });
>
>                tabs.add(new AbstractTab(new Model<String>("tab2"))
>                {
>                       �...@override
>                        public Panel getPanel(String panelId)
>                        {
>                                return new TaskCreateTabPanel2(panelId);
>                        }
>                });
>
>                tabs.add(new AbstractTab(new Model<String>("tab3"))
>                {
>                       �...@override
>                        public Panel getPanel(String panelId)
>                        {
>                                return new TaskCreateTabPanel3(panelId);
>                        }
>                });
>
>                add(new TabbedPanel("tabs", tabs).add(new 
> AttributeModifier("class", true, this.getDefaultModel())));
>
>            Form form = new Form("form") {
>                protected void onSubmit() {
>                }
>            };
>
>            Button buttonsave = new Button("buttonsave") {
>                public void onSubmit()
>                {
>                                //Here we should get the TextField value and 
> save it into db
>                }
>            };
>            form.add(buttonsave);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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

Reply via email to