And my pseudo code was wrong, I meant to add the model to a component.
final IModel<Boolean> modelForAgree = new
Model<Boolean>("yes".equalsIgnoreCase(obj.getAgree())));
final AjaxCheckBox yesChoiceBox = new AjaxCheckBox( "Agree", modelForAgree) {
}
form.add(yesChoiceBox)
I have another question, in the case of the checkbox, it expects a model with a
boolean value.
I would need to add a property field that holds a boolean? Is this correct.
Let's say the property has a string?
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of James Carman
Sent: Monday, October 04, 2010 9:13 AM
To: [email protected]
Subject: Re: Understanding the model, initial/default value
You're not binding your model to the "agree" property, really. So, if the
value changes, it won't update your model. If you want to bind it, use a
PropertyModel.
On Mon, Oct 4, 2010 at 9:06 AM, Brown, Berlin [GCG-PFS]
<[email protected]> wrote:
> Panel.java:
> ...
> final IModel<Boolean> modelForAgree = new
> Model<Boolean>("yes".equalsIgnoreCase(obj.getAgree())));
>
> form.add(modelForAgree);
> ...
>
> In this code, how can I ensure that modelForAgree has the right
> default value when the panel loads. Is it possible that the Panel
> gets deserialized with an older version of modelForAgree?
>
> Berlin Brown
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]