It
seemed I had to give my Radiogroup a model to hold the selected value. Do I
both need to have a model for my radiochoice and my radiogroup, or does my
radiochoice inherit the model from the radiogroup? Do I need to define this
explicit? -regards
Nino From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hi I know I am doing something wrong im just not sure whatJ I have a radiogroup, which I populate with radio buttons, in a listview:
myRadioGroup
= new wicket.markup.html.form.RadioGroup("radiogroup");
form.add(myRadioGroup);
myRadioGroup.add(new
Label("LBL_maaling", "Målinger"));
myList =
new wicket.markup.html.list.ListView("maaling", maalinger) {
public
void populateItem(wicket.markup.html.list.ListItem item) {
String[]
myText = (String[]) item.getModelObject();
String
radiotext = myText[0].toString();
String infotext = myText[1].toString();
Model
RadioModel = new Model(myText[0]);
wicket.markup.html.form.Radio
myRadio = new wicket.markup.html.form.Radio(
"RadioMaaling",
RadioModel);
item.add(myRadio);
item.add(new
Label("radioText", radiotext));
item.add(new
Label("info", infotext));
}
};
myRadioGroup.add(myList); This gives me the Layout I want, im not sure if I am populating
correctly. This is my test code
below (which fails at the line I’ve marked red.) I’ve also tried just setting
the value for “radiogroup” that gives me this error: submitted http
post value [p? varighed] for RadioGroup component [1:panel:form:radiogroup] 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.
WicketTester
tester = new WicketTester();
final
RadioInfo RadioInfo = new RadioInfo("panel",maalinger,tilgang);
tester.startPanel(new
TestPanelSource(){
public
Panel getTestPanel(String arg0) {
return
RadioInfo;
}
});
FormTester
myFormTester= tester.newFormTester("panel:form");
tester.debugComponentTrees();
tester.dumpPage();
myFormTester.setValue("radiogroup:maaling:2:RadioMaaling",
"Aktuelle forl�b fordelt p�
varighed");
myFormTester.submit();
System.out.println(RadioInfo.getResult());
tester.dumpPage(); debugComponentTrees() shows this: 94
[main] INFO wicket.util.tester.WicketTester - debugging
---------------------------------------------- 94
[main] INFO wicket.util.tester.WicketTester -
path panel ams.components.RadioInfo
[] 94
[main] INFO wicket.util.tester.WicketTester -
path panel:form
wicket.markup.html.form.Form [] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:tilgang
wicket.markup.html.form.RadioChoice
[] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup
wicket.markup.html.form.RadioGroup [] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:LBL_maaling
wicket.markup.html.basic.Label [M�linger] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling
wicket.markup.html.list.ListView
[[[Ljava.lang.String;@1ee3914, [Ljava.lang.String;@e5855a,
[Ljava.lang.String;@95fd19]] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:0
wicket.markup.html.list.ListItem
[[Ljava.lang.String;@1ee3914] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:0:RadioMaaling
wicket.markup.html.form.Radio [Aktuelle forl�b fordelt p� varighed] 109 [main]
INFO wicket.util.tester.WicketTester -
path
panel:form:radiogroup:maaling:0:radioText
wicket.markup.html.basic.Label [Aktuelle forl�b fordelt p�
varighed] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:0:info
wicket.markup.html.basic.Label [description] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:1
wicket.markup.html.list.ListItem
[[Ljava.lang.String;@e5855a] 109 [main]
INFO wicket.util.tester.WicketTester -
path
panel:form:radiogroup:maaling:1:RadioMaaling
wicket.markup.html.form.Radio [antal forl�b] 109 [main]
INFO wicket.util.tester.WicketTester -
path
panel:form:radiogroup:maaling:1:radioText
wicket.markup.html.basic.Label [antal forl�b] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:1:info
wicket.markup.html.basic.Label [description] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:2
wicket.markup.html.list.ListItem
[[Ljava.lang.String;@95fd19] 109 [main]
INFO wicket.util.tester.WicketTester -
path
panel:form:radiogroup:maaling:2:RadioMaaling
wicket.markup.html.form.Radio [Forl�b pr. ber�rt] 109 [main]
INFO wicket.util.tester.WicketTester -
path
panel:form:radiogroup:maaling:2:radioText
wicket.markup.html.basic.Label [Forl�b pr. ber�rt] 109 [main]
INFO wicket.util.tester.WicketTester -
path panel:form:radiogroup:maaling:2:info
wicket.markup.html.basic.Label [description] Any help will be much appreciated. Regards Nino |
Title: RadioGroup: test fails
- [Wicket-user] RadioGroup: test fails Nino Wael
- RE: [Wicket-user] RadioGroup: test fails Nino Wael
- RE: [Wicket-user] RadioGroup: test fails Nino Wael
- Re: [Wicket-user] RadioGroup: test fails Johan Compagner