Hi Marco,
I haven't tested this, but I believe this should do the trick:
class PhoneNumber {
String number;
boolean default;
/* Add getters and setters for both */
}
public void EditPhonePanel(String id, PhoneNumber phoneNumber) {
CompoundPropertyModel model = new CompoundPropertyModel(phoneNumber);
add(TextField("number"), model.bind("number"));
add(Radio("default", model.bind("default")));
}
Let me know if this works.
Cheers,
Rodrigo
On Tue, Aug 9, 2011 at 6:48 PM, Marco Aurélio Silva <[email protected]> wrote:
> Hi All
>
> I'm having problems to make a radio component work the way I need.
>
> I have a list of PhoneNumber objects:
>
> class PhoneNumber {
>
> String number;
> boolean default;
> }
>
> The list can have only one entry set as default value. I'm trying to
> make the radio button set the value of default in each object, so when
> I submit the form to save the object my model is synced with user
> changes. I don't want to set the value in the radioGroup model.
>
> I've created a Panel to edit a single phoneNumber object:
>
>
> public void EditPhonePanel(String id, PhoneNumber phoneNumber) {
>
> setModel(new CompoundPropertyModel(phoneNumber));
>
> add(TextField("number"));
>
> add(Radio("default"));
>
> }
>
>
> And I'm using a repeater to add one EditPhonePanel for each phone in my list.
>
> The number property of PhoneNumber object is being updated as
> expected, but I don't know how to make the radio button update the
> default property. Can someone help me? Thanks in advance!
>
> I'm using wicket 1.3.6 and java 5
>
> Marco Silva
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Rodrigo H M Bezerra
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]