You need to give form components like DropDownChoice and TextField an IModel into which the submitted value will be placed. You did this with a PropertyModel for your DropDownChoice. You need to do similar for the TextField.
Good luck, I hope you enjoy Wicket! On Tue, Mar 13, 2012 at 10:26 AM, xiaowang <[email protected]> wrote: > I am totally new in wicket, can anyone help me? > Now my code is: > > //dropdownbox > add(new FeedbackPanel("dropdownfeedback")); > DropDownChoice<String> listSites = new > DropDownChoice<String>( > "sites", new PropertyModel<String>(this, > "selected"), > SEARCH_ENGINES); > > > Form<?> dropdownform = new Form<Void>("dropdownform") { > @Override > protected void onSubmit() { > > info("You select : " + selected); > > } > }; > > //add name text > TextField<String> Name = new TextField<String>("Name"); > Name.setRequired(true); > dropdownform.add(Name); > ComponentFeedbackPanel fbName = new > ComponentFeedbackPanel("fbName", Name); > dropdownform.add(fbName); > //add Age text > TextField<String> Age = new TextField<String>("Age"); > Age.setRequired(true); > dropdownform.add(Age); > ComponentFeedbackPanel fbAge = new > ComponentFeedbackPanel("fbAge", > Age); > dropdownform.add(fbAge); > > add(dropdownform); > dropdownform.add(listSites); > > It get a "Attempt to set model object on null model of component: > dropdownform:Name" > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/How-to-submit-a-result-of-dropdownchoice-and-a-result-of-input-text-simultaneously-tp4469660p4469677.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
