You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Philipp Daumke <da...@averbis.de> on 2009/05/09 10:51:11 UTC

CheckboxMultipleChoice in Ajax style

Hi all,

I wonder how I can create a CheckboxMultipleChoice that performs an 
action "onUpdate". Ideally, the action is delayed by one second, so that 
a user has the chance to change more than one checkbox before the change 
is sent to the server (without a submit button).

As I'm quite new to wicket, any code fragment would be greatly appreciated.
All the best
Philipp
-- 

Averbis GmbH
c/o Klinikum der Albert-Ludwigs-Universität
Stefan-Meier-Strasse 26
D-79104 Freiburg

Fon: +49 (0) 761 - 203 6707
Fax: +49 (0) 761 - 203 6800
E-Mail: daumke@averbis.de

Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó
Sitz der Gesellschaft: Freiburg i. Br.
AG Freiburg i. Br., HRB 701080


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


Re: CheckboxMultipleChoice in Ajax style

Posted by Philipp Daumke <da...@averbis.de>.
Mathias,

I changed a bit of code and now it works without problems. I even can't 
reproduce what was the problem.

Thank's a lot for your help
Philipp
> When I try this code it works. Can you please post some code for us
>   


-- 

Averbis GmbH
c/o Klinikum der Albert-Ludwigs-Universität
Stefan-Meier-Strasse 26
D-79104 Freiburg

Fon: +49 (0) 761 - 203 6707
Fax: +49 (0) 761 - 203 6800
E-Mail: daumke@averbis.de

Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó
Sitz der Gesellschaft: Freiburg i. Br.
AG Freiburg i. Br., HRB 701080


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


Re: CheckboxMultipleChoice in Ajax style

Posted by Mathias Nilsson <wi...@gmail.com>.
When I try this code it works. Can you please post some code for us
-- 
View this message in context: http://www.nabble.com/CheckboxMultipleChoice-in-Ajax-style-tp23458553p23520363.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: CheckboxMultipleChoice in Ajax style

Posted by Philipp Daumke <da...@averbis.de>.
Hi Mathias, hi all,

thanks for your help, I didn't know the 
AjaxFormChoiceComponentUpdatingBehavior so far.

I now have the problem, that it jumps into the onUpdate method just once 
(when I click on a checkbox for the first time). If I click again on the 
same or any other checkbox, nothing happens. Does anyone have an 
explanation for that?

Thank you
Philipp


> This may confuse the web user quite a bit. It's preferred to send the request
> each time or cache it maybe.
>
> Form form = new Form( "form" );
> 		List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby",
> "Java.Net" });
> 		final List<String> values = new LinkedList<String>();
> 		final CheckBoxMultipleChoice c = new CheckBoxMultipleChoice("site", new
> Model(),  SITES );
> 		c.add( new AjaxFormChoiceComponentUpdatingBehavior(){
> 			@Override
> 			protected void onUpdate(AjaxRequestTarget target) {
> 				
> 				System.out.println( c.getModelObject() );
> 			}
> 			
> 		});
> 		form.add( c );
> 		add( form );
>
> In this onUpdate you could send to server, cache or whatever.
>   


-- 

Averbis GmbH
c/o Klinikum der Albert-Ludwigs-Universität
Stefan-Meier-Strasse 26
D-79104 Freiburg

Fon: +49 (0) 761 - 203 6707
Fax: +49 (0) 761 - 203 6800
E-Mail: daumke@averbis.de

Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó
Sitz der Gesellschaft: Freiburg i. Br.
AG Freiburg i. Br., HRB 701080


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


Re: CheckboxMultipleChoice in Ajax style

Posted by Mathias Nilsson <wi...@gmail.com>.
This may confuse the web user quite a bit. It's preferred to send the request
each time or cache it maybe.

Form form = new Form( "form" );
		List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby",
"Java.Net" });
		final List<String> values = new LinkedList<String>();
		final CheckBoxMultipleChoice c = new CheckBoxMultipleChoice("site", new
Model(),  SITES );
		c.add( new AjaxFormChoiceComponentUpdatingBehavior(){
			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				
				System.out.println( c.getModelObject() );
			}
			
		});
		form.add( c );
		add( form );

In this onUpdate you could send to server, cache or whatever.
-- 
View this message in context: http://www.nabble.com/CheckboxMultipleChoice-in-Ajax-style-tp23458553p23470100.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