You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Zeldor <pg...@gmail.com> on 2010/09/05 23:43:26 UTC

checkGroup - 2 out of 5?

Hi,

I want to limit users to check exactly 2 options out of X. How can I do
that? I'd also like it to switch last chosen one to new one, if user has
already picked 2 [so it'd deselect last one and choose another, instead of
not doing anything at all]. 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527723.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


Re: checkGroup - 2 out of 5?

Posted by nino martinez wael <ni...@gmail.com>.
and still need that validator...

2010/9/7 Xavier López <xa...@gmail.com>

> To switch the last check with the first checked in case there are two of
> them checked already, you could also use an
> AjaxFormComponentUpdatingBehavior to do it server-side, though that would
> only be disadvantages. I remember some nasty issues with the onchange event
> on checkboxes with IE, and the server-side ajax would be just doing dom
> attribute manipulations. You'll be much better off doing it with JS, as
> Igor
> stated.
>
> Cheers,
> Xavi
>
> 2010/9/7 nino martinez wael <ni...@gmail.com>
>
> > yup validator's more correct
> >
> > 2010/9/7 Xavier López <xa...@gmail.com>
> >
> > > I'd do it with a component validator. That would avoid the Form's
> > onSubmit
> > > being called and getting the model updated with incorrect user data. Or
> > > also
> > > with a FormValidator. If I remember correctly, you can call
> > > getConvertedInput to get the Checkgroup's list of selected values.
> > >
> > > Cheers,
> > > Xavi
> > >
> > > 2010/9/7 nino martinez wael <ni...@gmail.com>
> > >
> > > > you an also do it server side... just check your model on submit
> etc..
> > > >
> > > > 2010/9/6 Zeldor <pg...@gmail.com>
> > > >
> > > > >
> > > > > Oh, I hoped that it can be avoided. So anyone has AJAX example at
> > hand?
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527763.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
> > > > >
> > > > >
> > > >
> > >
> >
>
>
>
> --
> "Klein bottle for rent--inquire within."
>

Re: checkGroup - 2 out of 5?

Posted by Xavier López <xa...@gmail.com>.
To switch the last check with the first checked in case there are two of
them checked already, you could also use an
AjaxFormComponentUpdatingBehavior to do it server-side, though that would
only be disadvantages. I remember some nasty issues with the onchange event
on checkboxes with IE, and the server-side ajax would be just doing dom
attribute manipulations. You'll be much better off doing it with JS, as Igor
stated.

Cheers,
Xavi

2010/9/7 nino martinez wael <ni...@gmail.com>

> yup validator's more correct
>
> 2010/9/7 Xavier López <xa...@gmail.com>
>
> > I'd do it with a component validator. That would avoid the Form's
> onSubmit
> > being called and getting the model updated with incorrect user data. Or
> > also
> > with a FormValidator. If I remember correctly, you can call
> > getConvertedInput to get the Checkgroup's list of selected values.
> >
> > Cheers,
> > Xavi
> >
> > 2010/9/7 nino martinez wael <ni...@gmail.com>
> >
> > > you an also do it server side... just check your model on submit etc..
> > >
> > > 2010/9/6 Zeldor <pg...@gmail.com>
> > >
> > > >
> > > > Oh, I hoped that it can be avoided. So anyone has AJAX example at
> hand?
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527763.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
> > > >
> > > >
> > >
> >
>



-- 
"Klein bottle for rent--inquire within."

Re: checkGroup - 2 out of 5?

Posted by nino martinez wael <ni...@gmail.com>.
yup validator's more correct

2010/9/7 Xavier López <xa...@gmail.com>

> I'd do it with a component validator. That would avoid the Form's onSubmit
> being called and getting the model updated with incorrect user data. Or
> also
> with a FormValidator. If I remember correctly, you can call
> getConvertedInput to get the Checkgroup's list of selected values.
>
> Cheers,
> Xavi
>
> 2010/9/7 nino martinez wael <ni...@gmail.com>
>
> > you an also do it server side... just check your model on submit etc..
> >
> > 2010/9/6 Zeldor <pg...@gmail.com>
> >
> > >
> > > Oh, I hoped that it can be avoided. So anyone has AJAX example at hand?
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527763.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
> > >
> > >
> >
>

Re: checkGroup - 2 out of 5?

Posted by Xavier López <xa...@gmail.com>.
I'd do it with a component validator. That would avoid the Form's onSubmit
being called and getting the model updated with incorrect user data. Or also
with a FormValidator. If I remember correctly, you can call
getConvertedInput to get the Checkgroup's list of selected values.

Cheers,
Xavi

2010/9/7 nino martinez wael <ni...@gmail.com>

> you an also do it server side... just check your model on submit etc..
>
> 2010/9/6 Zeldor <pg...@gmail.com>
>
> >
> > Oh, I hoped that it can be avoided. So anyone has AJAX example at hand?
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527763.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
> >
> >
>

Re: checkGroup - 2 out of 5?

Posted by nino martinez wael <ni...@gmail.com>.
you an also do it server side... just check your model on submit etc..

2010/9/6 Zeldor <pg...@gmail.com>

>
> Oh, I hoped that it can be avoided. So anyone has AJAX example at hand?
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527763.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
>
>

Re: checkGroup - 2 out of 5?

Posted by Zeldor <pg...@gmail.com>.
Oh, I hoped that it can be avoided. So anyone has AJAX example at hand? 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527763.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


Re: checkGroup - 2 out of 5?

Posted by Igor Vaynberg <ig...@gmail.com>.
you have to do this with javascript

-igor

On Sun, Sep 5, 2010 at 2:43 PM, Zeldor <pg...@gmail.com> wrote:
>
> Hi,
>
> I want to limit users to check exactly 2 options out of X. How can I do
> that? I'd also like it to switch last chosen one to new one, if user has
> already picked 2 [so it'd deselect last one and choose another, instead of
> not doing anything at all].
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/checkGroup-2-out-of-5-tp2527723p2527723.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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org