NOTE: I'm stuck at Wicket 1.2.4 and cannot upgrade yet.

I've got a very simple form with an input class that looks like this:

****************************
public class PaymentInfoInput implements Serializable
{
        private Boolean optedForNewsletter;

.....................................

        public Boolean isOptedForNewsletter()
        {
                return this.optedForNewsletter;
        }
        
        public void setOptedForNewsletter(Boolean optedForNewsletter)
        {
                this.optedForNewsletter = optedForNewsletter;
        }
}
****************************

When the page loads I load a boolean value into my CheckBox from an entity,
like so:

****************************
                //model for checkbox value
                IModel checkedModel = new 
Model(customer.isOptedForNewsletter());
                
                //newsletter opt-in checkbox
                form.add(new CheckBox("optedForNewsletter", checkedModel));
****************************

...I've walked through this portion in the debugger, it loads the correct
value.

Now, when I submit the form, regardless of whether or not the CheckBox is
checked, the value is null:

****************************
                //create form           
                final Form form = new Form("paymentInfoForm", new
CompoundPropertyModel(new PaymentInfoInput()));

...........................................

                //submit button
                form.add(new Button("completeOrderButton")
                {
                        public void onSubmit()
                        {
                                try
                                {
                                        //get form input
                                        PaymentInfoInput input = 
(PaymentInfoInput)form.getModelObject();
                                        Boolean opted =
input.isOptedForNewsletter(); //WHY IS THIS NULL?
                                }
                                catch (Exception exp)
                                {
                                        LogProxy.saveEntry(exp);
                                }
                        }
                });

...in the HTML:

<input type="checkbox" wicket:id="optedForNewsletter" value="true" />
****************************

...what's up with that?  I must be missing something painfully simple.

Thanks!
-- 
View this message in context: 
http://www.nabble.com/CheckBox-is-misbehaving...-tf4563018.html#a13022997
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to