[ https://issues.apache.org/jira/browse/WICKET-2694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
smallufo updated WICKET-2694: ----------------------------- Attachment: pic.GIF screen capture > Dynamic Form inconsistent behavior inside/outside a ListView > ------------------------------------------------------------ > > Key: WICKET-2694 > URL: https://issues.apache.org/jira/browse/WICKET-2694 > Project: Wicket > Issue Type: Bug > Components: wicket > Affects Versions: 1.4.5 > Environment: Wicket 1.4.5 , resin-3.1.9 , CentOS 5.4 > Reporter: smallufo > Attachments: pic.GIF, wicket2694.tar.gz > > > The original discuss thread is here : > http://old.nabble.com/Cannot-get-default-invisible-TextField's-ModelObject---td27251305.html > I have a form , which is embedded in a ListView , > The form contains a radio button. > When user clicks the radio button , a default-invisible textfield is set > visible. > But I cannot get the textfield's Model Object , it is null ... > To make it more clear : > When the radio button is clicked , by implement AjaxEventBehavior("onClick") > , a default-invisible WebMarkupContainer is set visible , > The WebMarkupContainer contains other TextFields , which I cannot get their > values at all .... > If the form is not embedded in a ListView , everything works fine . > I think it is an inconsistent behavior and should be fixed. > MyPage.html > <table border="1"> > <tr> > <th>name</th> > <th>more ?</th> > </tr> > <span wicket:id="listView"> > <form wicket:id="form"> > <tr> > <td wicket:id="name">[name]</td> > <td> > <span wicket:id="radioGroup"> > <input type="radio" wicket:id="yes"/>yes > <input type="radio" wicket:id="no"/>no > </span> > </td> > </tr> > <tr wicket:id="more"> > <td colspan="2"> > <input type="text" size="40" value="Please leave comments" > wicket:id="textfield"/> > <input type="submit" value="Submit" wicket:id="submit"/> > </td> > </tr> > </form> > </span> > </table> > public class MyPage extends WebPage > { > private final static List<String> names = new ArrayList<String>(); > static > { > names.add("Andy"); > names.add("Brian"); > names.add("Carol"); > } > public MyPage() > { > ListView<String> listView = new ListView<String>("listView" , names) > { > @Override > protected void populateItem(ListItem<String> item) > { > Form<Void> form = new Form<Void>("form"); > item.add(form); > String name = item.getModelObject(); > form.add(new Label("name" , name)); > final WebMarkupContainer more = new WebMarkupContainer("more"); > more.setVisible(false); > more.setOutputMarkupPlaceholderTag(true); > form.add(more); > final RadioGroup<Boolean> radioGroup = new > RadioGroup<Boolean>("radioGroup" , Model.of(Boolean.FALSE)); > form.add(radioGroup); > Radio<Boolean> yes = new Radio<Boolean>("yes" , > Model.of(Boolean.TRUE)); > Radio<Boolean> no = new Radio<Boolean>("no" , > Model.of(Boolean.FALSE)); > radioGroup.add(yes); > radioGroup.add(no); > yes.add(new AjaxEventBehavior("onClick") > { > @Override > protected void onEvent(AjaxRequestTarget target) > { > more.setVisible(true); > target.addComponent(more); > } > }); > no.add(new AjaxEventBehavior("onClick") > { > @Override > protected void onEvent(AjaxRequestTarget target) > { > more.setVisible(false); > target.addComponent(more); > } > }); > final TextField<String> textfield = new > TextField<String>("textfield" , new Model<String>()); > more.add(textfield); > AjaxButton button = new AjaxButton("submit") > { > @Override > protected void onSubmit(AjaxRequestTarget arg0, Form<?> form) > { > System.out.println("radioGroup = " + radioGroup.getModelObject() > + " , textfield.getModelObject() = " + textfield.getModelObject()); > } > }; > more.add(button); > } > }; > add(listView); > } > } > screen capture : > http://xs.to/image-B859_4B57CDD0.gif -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.