Re: [Wicket-user] Radio, AJAX and Model: What ist he correct type for a radio button property model

2006-07-17 Thread Stefan Lindner
This works very well. Thank you!

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Radio, AJAX and Model: What ist he correct type for a radio button property model

2006-07-17 Thread Igor Vaynberg
the model of each radio returns the object that you want put into the model of the radiogroup so the type of both models is the samenew RadioGroup("foo", new PropertyModel(this, "person"));
new Radio("bar", new Model(new Person(...)));so if you want the value to be preselected you have to put the right object inside the model of the radiogroup-Igor
On 7/17/06, Stefan Lindner <[EMAIL PROTECTED]> wrote:
Hi all,What ist he correct type for a radio button property model?I want to use RadioButtons with AJAX. I have found a hint in the mailinglist archive that I have to use RadioGroup and add an ajax event to each
Radio Object in the radio group. This works.But now: when I want one of the radio buttons to be preselected I needto bind a model to the radio button.Let's assume that I have HTML like this 
   Select a person
cellpadding="2">
wicket:id="radio"/>wicket:id="name">[this is where name will be]
  
  ...The java part looks like thisfinal RadioGroup group = newRadioGroup("group");Form form = new Form("form");
add(form);form.add(group);ListView persons = new ListView("persons",getPersons()) {protected void populateItem(ListItem
item) {Radio r = new Radio("radio",item.getModel());r.add(newAjaxEventBehavior("onchange") {   protected void
onEvent(AjaxRequestTarget target) {   System.out.println("--" +getComponent().getModelObject().toString);} });
item.add(r);item.add(new Label("name", newPropertyModel(item.getModel(), "name")));}
};group.add(persons);This works well in one way: I can receive the AJAX event when a radiobutton is selectd.But now I want to have one radio buttln preselect when I display the
panel.When I try to add a PropertyModel to the radio buttonRadio r = new Radio("radio", new PropertyModel(item.getModel(),"radio"));I can see calls to getRadio in my ModelClass when the components are
rendered the first time. But when I klick into a radio butteln a classcast Exception is thrown. I tried a boolean, a Boolean and a String astype for the radio button but alway a class cast exception is thrown.
Now once again the question: What ist he correct type for a radio buttonproperty model and what ist he default value to have one radio buttonselected.-
Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user