Hey all,
Please allow me to preface this by saying I'm pretty much brand new to java web development so I hope I'm explaining this problem correctly.
I've inherited a wicket website from a fellow who has left for greener pastures and there has been a request to ask new users to include their race and ehthnicity upon registration to the website. So I've added the appropriate questions to the page... so far so good.
The problem I'm getting now is that when I submit the page the new values don't seem to get updated. I'm going to post the code here for the racial question but the ethnicity question is almost identical. It may be important to note that a user should be able to select more than one race or no races at all when registration occurs.
My relevant mark-up:
<span wicket:id="selectOneOrMoreRaces">Select one or more races to indicate what you consider yourself to be.</span>
<br />
<span class="field" wicket:id="races">
<span wicket:id="races">
<input wicket:id="races.value" type="checkbox" />
<span wicket:id="racDesc" style="font-weight:normal;">Race Text</span>
<br />
</span>
</span>
Here's the bit of code for that page:
String raceQuestion = fhDAO.getRaceQuestion();
Label selectOneOrMoreRacesLabel = new Label("selectOneOrMoreRaces", new Model(raceQuestion));
add(selectOneOrMoreRacesLabel);
CheckGroup racesCheckGroup = new CheckGroup("races");
add(racesCheckGroup);
ListView races = new ListView("races", fhDAO.getRaceAnswers())
{
protected void populateItem(ListItem item)
{
RaceAnswer access = (RaceAnswer)item.getModelObject();
CheckBox chk = new CheckBox("races.value", new Model(access.getValue()));
item.add(chk);
item.add(new Label("racDesc", access.getDescription()));
}
};
racesCheckGroup.add(races);
Here's the model for the RaceAnswers:
public class RaceAnswer implements Serializable
{
private String _description;
private String _value;
public RaceAnswer(String description, String value)
{
_description = description;
_value = value;
}
public String getDescription()
{
return _description;
}
public String getValue()
{
return _value;
}
}
And finally, the relevant code for my races property in my user class:
private ArrayList<RaceAnswer> race;
public ArrayList<RaceAnswer> getRaces()
{
return race;
}
public void setRaces(ArrayList<RaceAnswer> races)
{
race = races;
}
Thanks in advance for any assistance that can be rendered.
-Sonny