On Tue, Jul 3, 2012 at 9:24 PM, Alexander Cherednichenko <lex...@gmail.com> wrote: > Hi! > > As the first A in AJAX stands for Asynchronous, you may hit weird results > with this solution, especially on slow internet connection. Which means > that no one guarantees that if user clicks checkbox1 and then checkbox2 > answers would arrive in such a manner.
Wicket serializes the Ajax requests both at the client and at the server side, so there is a guarantee that request1 is processed before request2. You can disable the client side queueing by overriding ajax behavior's #getAjaxChannel() method though. > > What I would do in this case - I would just write a very simple JQuery > callback which would listen to checkbox check/uncheck events and would > disable remaining checkboxes once 5 are selected, plus show warning. It is > synchronous, immediate, and the rule - max 5 - seems to be easy to employ > on the client side. > > Surely we need to leave the check for 'max 5' in the onsubmit validator as > we want it to be independent of the javascript. I agree that client side checks will be much better for the user experience. > > Regards, > Alex. > > 2012/7/3 Martin Grigorov <mgrigo...@apache.org> > >> You can assign AjaxFormChoiceComponentUpdatingBehavior to the group >> and check its model object's size in #onUpdate() >> >> But this will fire Ajax requests for each and every click on the >> checkboxes. >> >> On Tue, Jul 3, 2012 at 7:09 PM, Dan12321 <wee...@centrum.cz> wrote: >> > Hi, >> > >> > I have CheckGroup<User> group = new CheckGroup<User>("usersGroup", list); >> > and in repeater I add checkbox: item.add(new Check<User>("checkboxUser", >> > group)); >> > >> > I have got 20 checkboxes, but I want to allow only 5 checkboxes select. >> When >> > will be selected more than 5 checkboxes, it shows error (in feedback). >> > I want to check this when the checkbox is selected (not after submitting >> > form). >> > Could help me, how can I do it? >> > >> > Thanks. >> > >> > -- >> > View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/chekbox-allow-only-5-selected-tp4650340.html >> > Sent from the Users forum 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 >> > >> >> >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > -- > Alexander Cherednichenko > > [ the only way out is the way up ] -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org