You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Travis Boswell <t....@nsai.com> on 2009/07/02 04:20:24 UTC

Problem with RadioGroup / Ajax

Hi,
I'm having an issue with a RadioGroup that is used in conjunction with a ListView, the populateItem method for the ListView looks like:

public void populateItem(final ListItem listItem) {
final PoDetailAdj pda = (PoDetailAdj) listItem.getModelObject();

      listItem.add(new Radio("radio-status-pending", new Model()));
listItem.add(new Radio("radio-status-approved", new Model()));
}

The RadioGroup encloses the entire ListView, and the RadioGroup is added to a form on the page. The display works fine, so I added AjaxFormChoiceComponentUpdatingBehavior to the RadioGroup, but changing the Radio values doesn't trigger the onUpdate method of the RadioGroup. I also tried having one RadioGroup per ListItem (a new RadioGroup defined for every row) but that didn't work either. I'm starting to think that maybe the ListView is the problem. Any thoughts or suggestions?

Travis Boswell



Re: Problem with RadioGroup / Ajax

Posted by Diego Fincatto <di...@gmail.com>.
I'm having the same problem when using two RadioGroup with
AjaxFormChoiceComponentUpdatingBehavior in the same page.

On Thu, Jul 2, 2009 at 6:07 AM, Mathias Nilsson
<wi...@gmail.com> wrote:
>
> I've made a sample page.
>
> public class HomePage extends WebPage {
>
>        private static final long serialVersionUID = 1L;
>
>    public HomePage(final PageParameters parameters) {
>
>       String[] choices = new String[]{ "Wicket", "Spring", "DB4O" };
>
>       final RadioGroup<String> group = new RadioGroup<String>("group", new
> Model<String>());
>       ListView<String> groupView = new ListView<String>( "groupView" ,
> Arrays.asList( choices )){
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                protected void populateItem(ListItem<String> item) {
>                        item.add(  new Radio<String>( "radio", new Model<String>() ));
>                }
>
>       };
>       group.setOutputMarkupId( true );
>       group.add( new AjaxFormChoiceComponentUpdatingBehavior(){
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                protected void onUpdate(AjaxRequestTarget target) {
>                        // TODO: Check this
>                        System.out.println( "Here" );
>                }
>
>       });
>
>       group.add(  groupView );
>
>       Form<Void> form = new Form<Void>( "form" );
>       form.add( group );
>       add( form );
>
>
>    }
> }
> --
> View this message in context: http://www.nabble.com/Problem-with-RadioGroup---Ajax-tp24300010p24302858.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


Re: Problem with RadioGroup / Ajax

Posted by Mathias Nilsson <wi...@gmail.com>.
I've made a sample page.

public class HomePage extends WebPage {

	private static final long serialVersionUID = 1L;

    public HomePage(final PageParameters parameters) {

       String[] choices = new String[]{ "Wicket", "Spring", "DB4O" };
       
       final RadioGroup<String> group = new RadioGroup<String>("group", new
Model<String>());
       ListView<String> groupView = new ListView<String>( "groupView" ,
Arrays.asList( choices )){
		private static final long serialVersionUID = 1L;

		@Override
		protected void populateItem(ListItem<String> item) {
			item.add(  new Radio<String>( "radio", new Model<String>() ));
		}
    	   
       };
       group.setOutputMarkupId( true );
       group.add( new AjaxFormChoiceComponentUpdatingBehavior(){
		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(AjaxRequestTarget target) {
			// TODO: Check this
			System.out.println( "Here" );
		}
    	   
       });
       
       group.add(  groupView );
       
       Form<Void> form = new Form<Void>( "form" );
       form.add( group );
       add( form );
    	
    	
    }
}
-- 
View this message in context: http://www.nabble.com/Problem-with-RadioGroup---Ajax-tp24300010p24302858.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