[ https://issues.apache.org/jira/browse/WICKET-2143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg closed WICKET-2143. --------------------------------- Resolution: Invalid > Palette in Form calls onSubmit twice, model is erased on second onSubmit > ------------------------------------------------------------------------ > > Key: WICKET-2143 > URL: https://issues.apache.org/jira/browse/WICKET-2143 > Project: Wicket > Issue Type: Bug > Components: wicket-extensions > Affects Versions: 1.3.5, 1.4-RC1, 1.4-RC2 > Reporter: Michael Mosmann > Assignee: Igor Vaynberg > Fix For: 1.4-RC2, 1.4-RC1, 1.3.5 > > Attachments: de.vergleich.bugs--wicket-bug-palette.zip > > > in following code, onSubmit is called twice, model is erased on second submit: > ---------------------------------------------------------------- > import java.util.ArrayList; > import java.util.Arrays; > import java.util.Collection; > import java.util.List; > import org.apache.wicket.extensions.markup.html.form.palette.Palette; > import org.apache.wicket.markup.html.WebPage; > import org.apache.wicket.markup.html.form.Button; > import org.apache.wicket.markup.html.form.ChoiceRenderer; > import org.apache.wicket.markup.html.form.Form; > import org.apache.wicket.model.IModel; > import org.apache.wicket.model.Model; > public class TestPalettePage extends WebPage > { > enum TestEnum { E1,E2,E3,E4 }; > > IModel<List<TestEnum>> _model=(IModel<List<TestEnum>>)(new Model(new > ArrayList(Arrays.asList(TestEnum.values())))); > IModel<Collection<TestEnum>> _choices=(IModel<Collection<TestEnum>>)(new > Model(new ArrayList(Arrays.asList(TestEnum.values())))); > > public TestPalettePage() > { > Form form=new Form("form") > { > @Override > protected void onSubmit() > { > System.out.println("Selected: "+_model.getObject()); > } > }; > > ChoiceRenderer<TestEnum> choiceRenderer=new > ChoiceRenderer<TestEnum>("name","ordinal"); > Palette<TestEnum> palette=new > Palette<TestEnum>("palette",_model,_choices,choiceRenderer,3,true); > form.add(palette); > form.add(new Button("submit")); > add(form); > } > } > ------------------------------------------------------- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.