I asked the following question on stack-overflow but was advised to ask here
instead.
http://stackoverflow.com/questions/4074028/in-wicket-how-can-i-create-radiogroups-that-are-not-defined-by-component-hierarc
I am using Wicket and would like to create a grid of radio buttons using
html as shown below (outer lists will be displayed vertically, inner lists
will be displayed horizontally).
I would like the radio buttons grouped vertically.
<ul>
<li>
<ul>
<li><input type="radio" name="A"></li>
<li><input type="radio" name="B"></li>
<li><input type="radio" name="C"></li>
</ul>
</li>
<li>
<ul>
<li><input type="radio" name="A"></li>
<li><input type="radio" name="B"></li>
<li><input type="radio" name="C"></li>
</ul>
</li>
<li>
<ul>
<li><input type="radio" name="A"></li>
<li><input type="radio" name="B"></li>
<li><input type="radio" name="C"></li>
</ul>
</li>
</ul>
Unfortunately it seems that RadioGroup only allow one to group radio buttons
according to the grouping defined by their layout.
eg RadioGroup group = new RadioGroup("radioGroupA");
group.add( new Radio("myradio", new Model(1)) ;
Problem with this is that I cannot then layout the way I want.
Is there another way? Manually specifying the name and gather results?
UPDATE: I notice that Radio can take a RadioGroup as a parameter. So one can
do something like:
// create some groups
for (0..n) {
RadioGroup group = new RadioGroup("myRadioGroup", new Model { .. } );
groupArray.add(group)
}
//create a ListView for the RadioGroups so we can attach them to page
ListView radioListView = ListView("radioGroupList") { populate from
groupArray }
add(radioListView);
// create our grid of radio buttons
// outer -> rows
for (0..x) {
// inner -> columns
for (0..n)
// supply group from our groupArray
add( new Radio("myradio", new Model(1), groupArray.get(n) ));
}
}
I can then add the Radios and RadioGroups to the form independently of
layout and this has the desired effect in terms of the grouping.
<form>
< span wicket:id="radioGroupList">
< span wicket:id="radioGroup"/>
< /span>
<ul>
<li><radio wicket:id="myradio"/></li>
But now, when I submit I am getting the following error:
WicketMessage: submitted http post value [radio33] for RadioGroup component
[2:tContainer:list:2:tPanel:myForm:orderedRadioGroupList:0:orderedRadioGroup]
is illegal because it does not contain relative path to a Radio componnet.
Due to this the RadioGroup component cannot resolve the selected Radio
component pointed to by the illegal value. A possible reason is that
componment hierarchy changed between rendering and form submission.
Any idea what this means?
The spelling mistake 'componment' suggests it's not seen too often.
I am using wicket 1.4.12.
I found this ticket that looks related too :
https://issues.apache.org/jira/browse/WICKET-1055
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-can-I-create-RadioGroups-that-are-not-defined-by-component-hierarchy-layout-tp3025204p3025204.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]