validations in a form with listView
I have a form , this has a listview , listview contains a chekbox.Upon form submit I want atleast one check box to be checked, In a formvalidator I use form.get(id ) this returns formComponent and formcomponent has a method getValue()but in case of listView how can I retrieve the formComponent and its value?
Re: validations in a form with listView
I tried this code please tell me if this is right code to retrieve to formcomponent from a list view ListFormComponent? formComponents= new ArrayListFormComponent?(); for(Iterator? extends ListItem? listItemIterator= ((ListView?)form.get(listViewId)).iterator();listItemIterator.hasNext(); ){ for(Iterator? extends Component itemChildrenIterator= listItemIterator.next().iterator() ;itemChildrenIterator.hasNext(); ){ Component component=itemChildrenIterator.next(); if(component instanceof FormComponent? component.getId().equals(id) ){ formComponents.add((FormComponent?)component); } } } return formComponents; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/validations-in-a-form-with-listView-tp2242009p2242137.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: validations in a form with listView
you can just add formcomponent to your arraylist in populateitem that will give you list of formcomponents. you can then validate them in your custom formvalidator.. On Thu, Jun 3, 2010 at 11:58 PM, fachhoch fachh...@gmail.com wrote: I tried this code please tell me if this is right code to retrieve to formcomponent from a list view ListFormComponent? formComponents= new ArrayListFormComponent?(); for(Iterator? extends ListItem? listItemIterator= ((ListView?)form.get(listViewId)).iterator();listItemIterator.hasNext(); ){ for(Iterator? extends Component itemChildrenIterator= listItemIterator.next().iterator() ;itemChildrenIterator.hasNext(); ){ Component component=itemChildrenIterator.next(); if(component instanceof FormComponent? component.getId().equals(id) ){ formComponents.add((FormComponent?)component); } } } return formComponents; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/validations-in-a-form-with-listView-tp2242009p2242137.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal