You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tubin gen <fa...@gmail.com> on 2010/06/03 19:06:33 UTC
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
Posted by vineet semwal <vi...@gmail.com>.
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 <fa...@gmail.com> wrote:
>
> I tried this code please tell me if this is right code to retrieve to
> formcomponent from a list view
>
>
>
> List<FormComponent<?>> formComponents= new
> ArrayList<FormComponent<?>>();
> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
regards,
Vineet Semwal
Re: validations in a form with listView
Posted by fachhoch <fa...@gmail.com>.
I tried this code please tell me if this is right code to retrieve to
formcomponent from a list view
List<FormComponent<?>> formComponents= new ArrayList<FormComponent<?>>();
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org