If you only need to select one Radio then one RadioGroup will work no matter how many nested radio's there are (the model object of the selected radio is assigned to the model object of the radio when the form submits)

If you actually have different radio's (i.e. multiple selections are allowed) then using RadioChoice may make more sense.

add (new ListView("listview") {

   protected void populateItem(final ListItem<T> item);

item.add (rc = new RadioChoice("choice", new Model<T>(), choiceList));

            rc.setPrefix("<li>");
            rc.setSuffix("</li>");

    }
}

<ul wicket:id="listview">
<span wicket:id="choice">
</ul>

Not tested but it should work close to this way and cause each <select type="radio">...</select> to be wrapped in a <li></li> like you want.

Mike

Ah but I have varying number of groups, hence the radioGroupList ( Sorry I
maybe didnt make this point clear enough). How can you nest them when you
dont know how many there will be?

On Wed, Nov 3, 2010 at 1:46 PM, Tom Howe<[email protected]>  wrote:

Ah but I have varying number of groups, hence the radioGroupList ( Sorry I
maybe didnt make this point clear enough). How can you nest them when you
dont know how many there will be?



On Wed, Nov 3, 2010 at 12:38 PM, Michael O'Cleirigh [via Apache Wicket]<
[email protected]<ml-node%[email protected]>
wrote:
Hi,

The RadioGroup just needs to wrap the radio's in your markup.  Typically
it does not even render markup in the resultant page.

Instead of this:
<form>
    <   span wicket:id="radioGroupList">
       <   span wicket:id="radioGroup"/>
    <   /span>
    <ul>
      <li><radio wicket:id="myradio"/></li>
do this:

<form>
<span wicket:id="radioGroup">
<ul wicket:id="listview">
<li>  <radio wicket:id="myradio"/></li>
<  /span>
</form>

add (rg = new RadioGroup("radioGroup"));

rd.add (new ListView("listView") {...});

This way the radio group will contain the Model Object of the Radio that
was selected by the user when the form submits.

Regards,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden 
email]<http://user/SendEmail.jtp?type=node&node=3025272&i=0>
For additional commands, e-mail: [hidden 
email]<http://user/SendEmail.jtp?type=node&node=3025272&i=1>



------------------------------
  View message @
http://apache-wicket.1842946.n4.nabble.com/How-can-I-create-RadioGroups-that-are-not-defined-by-component-hierarchy-layout-tp3025204p3025272.html
To unsubscribe from How can I create RadioGroups that are not defined by
component hierarchy/layout ?, click 
here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=3025204&code=dG9tbXl0YXN0aWNAZ21haWwuY29tfDMwMjUyMDR8MTM3MjA2NTU0MQ==>.





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to