The approach with Component radio= new Radio("radio", ...);
is the right one. You can still try to add the AttributeModifier, but probably, you'll end up fighting the Radio implementation (perhaps you'll have to create a subclass?) However, I don't see why you don't just use the regular wicket approach? Did you actually measure that there is more load on the server? I highly doubt it. Thomas On Tue, Feb 10, 2009 at 4:35 PM, Story Henry <henry.st...@bblfish.net>wrote: > Hi, > > I have been looking at how to set the value of a radio input field to a > value of my choosing. > If I use the Radio and Radio Group code as shown here: > http://pastebin.com/m40b9b073 > I get html such as > > <input wicket:id="radio" type="radio" value="radio2" > name="selectionGroup"/> > <input wicket:id="radio" type="radio" value="radio3" > name="selectionGroup"/> > ... > > whereas I was hoping to get > > <input wicket:id="radio" type="radio" value=" > http://bblfish.net/people/henry/card#me" name="selectionGroup"/> > > Searching the web I found the thread "Setting a relevant value for radio > buttons without using RadioChoice" from December 2008 ( > http://tinyurl.com/cpfj49 ) I came to understand that RadioGroup saves all > the mapping itself. I would rather it did not, reducing the load on the > server, as I am using URLs as primary keys. This more RESTful and I think > clearner. > > So if I cannot set this using the Radio component I thought perhaps I can > use an AttributeModifier with code like the following: > > class ChoiceForm extends Form { > > ChoiceForm(String string, List<Agent> agents) { > super(string); > ListView persons; > add(persons=new ListView("person", agents) { > > @Override > protected void populateItem(ListItem item) { > Agent agt = (Agent) item.getModelObject(); > Component radio = item.get("radio"); //this is wrong! looking > for solution > radio.add(new AttributeModifier("value",new > Model(agt.getWebID().toString()))); > item.add(new Label("name", agt.getName())); > item.add(new Label("uri", agt.getWebID().toString())); > } > }); > persons.setReuseItems(true); > } > } > > I am not sure how one can get a component in the populateItem function so > that one can then > change the attribute for it. > > The html I am trying to work with is this: > > <form wicket:id="select"> > <input type="submit" name="Select"/> > <span wicket:id="selectionGroup"> > <span wicket:id="person"> > <p> > <input wicket:id="radio" type="radio" value=" > http://bblfish.net/people/henry/card#me"/> > <table> > <tr><td>Name</td><td wicket:id="name">Henry Story</td></tr> > <tr><td>URI</td><td wicket:id="uri"> > http://bblfish.net/people/henry/card#me</td></tr> > </table> > </p> > </span> > </span> > <input type="submit" name="Select"/> > </form> > > Any suggestions as to where I should look for more information. I have > searched all over the internet and Wicket In Action, but without success. > > Henry Story > > Blog: http://blogs.sun.com/bblfish > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Thomas Mäder Wicket & Eclipse Consulting www.devotek-it.ch