You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ds26680 <ds...@googlemail.com> on 2008/10/31 15:29:22 UTC

Help with simple CheckBox example

I am new to creating web applications with Wicket and I am struggling with
getting a CheckBox to set a boolean variable in my domain object using a
PropertyModel. 

I have had a good search around on the web for examples and I think the code
bellow should work just fine. However when I click the submit button on my
form (after checking the checkbox), the domain model is not updated and the
print line in the onSubmit method always returns false. 

I have watched this code in the debugger and the setSelected method (in
domain class) never gets called.  Does anyone have an idea why the code
bellow should not work? 

I have created the following Java code for the view:-

    public HomePage() {

        MyForm form = new MyForm("form");
        add(form);
    }

    private class MyForm extends Form {

        private CheckBoxModel checkBoxModel = new CheckBoxModel();
        
        public MyForm(String s) {
            super(s);

            CheckBox myCheckBox = new CheckBox("selected",
                    new PropertyModel(checkBoxModel, "selected"));
            add(myCheckBox);
        }
    
        protected void onSubmit() {
            boolean bool = checkBoxModel.getSelected();

            // I expect this to print true when check box has been clicked
            System.out.println(bool);
        }
    }

My domain class is as follows:-

   public class CheckBoxModel {

        private boolean selected;

        public boolean getSelected() {
             return selected;
        }

        public void setSelected(boolean selected) {
             this.selected = selected;
        }

        public String toString() {
             return String.valueOf(selected);
        }
   }
  
Thanks in advance for your help.
-- 
View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20267081.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Igor Vaynberg <ig...@gmail.com>.
rofl

i guess you shouldve posted your markup sooner

<input wicket:id="selected" type="checkbox" value="" checked />

^ value="" there overrides the submitted value of the checkbox from
"on" back to "" and thus the checkbox is never selected.

simply remove value="" from your markup and all should work.

-igor

On Fri, Oct 31, 2008 at 4:13 PM, ds26680 <ds...@googlemail.com> wrote:
>
> I have zipped the project up and posted the file here.
>
> http://www.mediafire.com/?sharekey=80eaecc06e6b1b4dd2db6fb9a8902bda
>
> Hopefully, this will shed some light on my issues! Thanks in advance for
> your help.
>
>
> igor.vaynberg wrote:
>>
>> that looks fine too. package your project and attach it somewhere so
>> we can take a look.
>>
>> -igor
>>
>> On Fri, Oct 31, 2008 at 3:12 PM, ds26680 <ds...@googlemail.com> wrote:
>>>
>>> Here is my web.xml. This was auto generated as I used the QuickStart
>>> project
>>> generated off the Wicket website.
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>>>         version="2.4">
>>>
>>>        <display-name>checkboxtester</display-name>
>>>
>>>        <filter>
>>>                <filter-name>wicket.checkboxtester</filter-name>
>>>
>>> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>>>                <init-param>
>>>                        <param-name>applicationClassName</param-name>
>>>
>>> <param-value>com.indigoapp.WicketApplication</param-value>
>>>                </init-param>
>>>        </filter>
>>>
>>>  <filter-mapping>
>>>  <filter-name>wicket.checkboxtester</filter-name>
>>>        <url-pattern>/*</url-pattern>
>>>  </filter-mapping>
>>> </web-app>
>>>
>>> Any ideas? Thanks in advance for your help.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20274813.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20275410.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by ds26680 <ds...@googlemail.com>.
I have zipped the project up and posted the file here.

http://www.mediafire.com/?sharekey=80eaecc06e6b1b4dd2db6fb9a8902bda

Hopefully, this will shed some light on my issues! Thanks in advance for
your help.


igor.vaynberg wrote:
> 
> that looks fine too. package your project and attach it somewhere so
> we can take a look.
> 
> -igor
> 
> On Fri, Oct 31, 2008 at 3:12 PM, ds26680 <ds...@googlemail.com> wrote:
>>
>> Here is my web.xml. This was auto generated as I used the QuickStart
>> project
>> generated off the Wicket website.
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>>         version="2.4">
>>
>>        <display-name>checkboxtester</display-name>
>>
>>        <filter>
>>                <filter-name>wicket.checkboxtester</filter-name>
>>               
>> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>>                <init-param>
>>                        <param-name>applicationClassName</param-name>
>>                       
>> <param-value>com.indigoapp.WicketApplication</param-value>
>>                </init-param>
>>        </filter>
>>
>>  <filter-mapping>
>>  <filter-name>wicket.checkboxtester</filter-name>
>>        <url-pattern>/*</url-pattern>
>>  </filter-mapping>
>> </web-app>
>>
>> Any ideas? Thanks in advance for your help.
>> --
>> View this message in context:
>> http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20274813.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20275410.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Igor Vaynberg <ig...@gmail.com>.
that looks fine too. package your project and attach it somewhere so
we can take a look.

-igor

On Fri, Oct 31, 2008 at 3:12 PM, ds26680 <ds...@googlemail.com> wrote:
>
> Here is my web.xml. This was auto generated as I used the QuickStart project
> generated off the Wicket website.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>         version="2.4">
>
>        <display-name>checkboxtester</display-name>
>
>        <filter>
>                <filter-name>wicket.checkboxtester</filter-name>
>                <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>                <init-param>
>                        <param-name>applicationClassName</param-name>
>                        <param-value>com.indigoapp.WicketApplication</param-value>
>                </init-param>
>        </filter>
>
>  <filter-mapping>
>  <filter-name>wicket.checkboxtester</filter-name>
>        <url-pattern>/*</url-pattern>
>  </filter-mapping>
> </web-app>
>
> Any ideas? Thanks in advance for your help.
> --
> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20274813.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by ds26680 <ds...@googlemail.com>.
Here is my web.xml. This was auto generated as I used the QuickStart project
generated off the Wicket website.

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	 version="2.4">

	<display-name>checkboxtester</display-name>

	<filter>
		<filter-name>wicket.checkboxtester</filter-name>
 		<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
		<init-param>
			<param-name>applicationClassName</param-name>
			<param-value>com.indigoapp.WicketApplication</param-value>
 		</init-param>
 	</filter>

 <filter-mapping>
  <filter-name>wicket.checkboxtester</filter-name>
	<url-pattern>/*</url-pattern>
 </filter-mapping>
</web-app>

Any ideas? Thanks in advance for your help.
-- 
View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20274813.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Igor Vaynberg <ig...@gmail.com>.
what does your web.xml look like?

-igor

On Fri, Oct 31, 2008 at 2:22 PM, ds26680 <ds...@googlemail.com> wrote:
>
> Thanks for the reply, Igor. I have added a feedback panel and no validation
> or error messages are displayed. Here is my complete code listing for
> clarity of what I am working with.
>
> The Java class:-
>
> private static final long serialVersionUID = 1L;
>
>    public HomePage() {
>
>        MyForm form = new MyForm("form");
>        add(new FeedbackPanel("feedback"));
>        add(form);
>    }
>
>    private class MyForm extends Form {
>
>        private CheckBoxModel checkBoxModel = new CheckBoxModel();
>
>        public MyForm(String s) {
>            super(s);
>
>            FormComponentFeedbackBorder feedbackMessage = new
> FormComponentFeedbackBorder("feedbackMessage");
>            CheckBox myCheckBox = new CheckBox("selected",
>                            new PropertyModel(checkBoxModel, "selected"));
>
>            feedbackMessage.add(myCheckBox);
>            add(feedbackMessage);
>        }
>
>        protected void onSubmit() {
>            boolean bool = checkBoxModel.getSelected();
>            System.out.println(bool);
>        }
>    }
>
> The Domain Model:-
>
>   public class CheckBoxModel implements Serializable {
>
>   public boolean selected;
>
>    public boolean getSelected() {
>        System.out.println("getSelected() has been called");
>        return selected;
>    }
>
>    public void setSelected(boolean selected) {
>        System.out.println("setSelected() have been caled: " +
> this.selected);
>        this.selected = selected;
>    }
>
>    public String toString() {
>        return String.valueOf(selected);
>    }
>  }
>
> When I load this page, select the checkbox and click the submit button, the
> following debug is printed:-
>
> getSelected() has been called
> INFO  - RequestListenerInterface   - registered listener interface
> [RequestListenerInterface name=INewBrowserWindowListener, method=public
> abstract void
> org.apache.wicket.markup.html.INewBrowserWindowListener.onNewBrowserWindow()]
> getSelected() has been called
> getSelected() has been called
> false
>
> Does anyone have any ideas what is wrong or suggestions on how to get this
> to work? Thanks in advance for your help.
> --
> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20274222.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by ds26680 <ds...@googlemail.com>.
Thanks for the reply, Igor. I have added a feedback panel and no validation
or error messages are displayed. Here is my complete code listing for
clarity of what I am working with.

The Java class:-

private static final long serialVersionUID = 1L;

    public HomePage() {

        MyForm form = new MyForm("form");
        add(new FeedbackPanel("feedback"));
        add(form);
    }

    private class MyForm extends Form {

        private CheckBoxModel checkBoxModel = new CheckBoxModel();
        
        public MyForm(String s) {
            super(s);

            FormComponentFeedbackBorder feedbackMessage = new 
FormComponentFeedbackBorder("feedbackMessage");                         
            CheckBox myCheckBox = new CheckBox("selected", 
                            new PropertyModel(checkBoxModel, "selected"));
            
            feedbackMessage.add(myCheckBox);
            add(feedbackMessage);
        }
   
        protected void onSubmit() {
            boolean bool = checkBoxModel.getSelected();
            System.out.println(bool);
        }
    }

The Domain Model:-

   public class CheckBoxModel implements Serializable {

   public boolean selected;

    public boolean getSelected() {
        System.out.println("getSelected() has been called");
        return selected;
    }

    public void setSelected(boolean selected) {
        System.out.println("setSelected() have been caled: " +
this.selected);
        this.selected = selected;
    }

    public String toString() {
        return String.valueOf(selected);
    }
 }

When I load this page, select the checkbox and click the submit button, the
following debug is printed:-

getSelected() has been called
INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=INewBrowserWindowListener, method=public
abstract void
org.apache.wicket.markup.html.INewBrowserWindowListener.onNewBrowserWindow()]
getSelected() has been called
getSelected() has been called
false

Does anyone have any ideas what is wrong or suggestions on how to get this
to work? Thanks in advance for your help.
-- 
View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20274222.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Igor Vaynberg <ig...@gmail.com>.
new PropertyModel(this, "checkBoxModel.selected"));

-igor

On Fri, Oct 31, 2008 at 7:29 AM, ds26680 <ds...@googlemail.com> wrote:
>
> I am new to creating web applications with Wicket and I am struggling with
> getting a CheckBox to set a boolean variable in my domain object using a
> PropertyModel.
>
> I have had a good search around on the web for examples and I think the code
> bellow should work just fine. However when I click the submit button on my
> form (after checking the checkbox), the domain model is not updated and the
> print line in the onSubmit method always returns false.
>
> I have watched this code in the debugger and the setSelected method (in
> domain class) never gets called.  Does anyone have an idea why the code
> bellow should not work?
>
> I have created the following Java code for the view:-
>
>    public HomePage() {
>
>        MyForm form = new MyForm("form");
>        add(form);
>    }
>
>    private class MyForm extends Form {
>
>        private CheckBoxModel checkBoxModel = new CheckBoxModel();
>
>        public MyForm(String s) {
>            super(s);
>
>            CheckBox myCheckBox = new CheckBox("selected",
>                    new PropertyModel(checkBoxModel, "selected"));
>            add(myCheckBox);
>        }
>
>        protected void onSubmit() {
>            boolean bool = checkBoxModel.getSelected();
>
>            // I expect this to print true when check box has been clicked
>            System.out.println(bool);
>        }
>    }
>
> My domain class is as follows:-
>
>   public class CheckBoxModel {
>
>        private boolean selected;
>
>        public boolean getSelected() {
>             return selected;
>        }
>
>        public void setSelected(boolean selected) {
>             this.selected = selected;
>        }
>
>        public String toString() {
>             return String.valueOf(selected);
>        }
>   }
>
> Thanks in advance for your help.
> --
> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20267081.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by ds26680 <ds...@googlemail.com>.
Thanks for all your help Igor, that solved it! Rookie Error... :blush:
-- 
View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20275698.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
yes, the code works except some serialization errors..



Alan Romaniusc wrote:
> I can see no problem in your code. Maybe something else?
>
> On Fri, Oct 31, 2008 at 12:29 PM, ds26680 <ds...@googlemail.com> wrote:
>   
>> I am new to creating web applications with Wicket and I am struggling with
>> getting a CheckBox to set a boolean variable in my domain object using a
>> PropertyModel.
>>
>> I have had a good search around on the web for examples and I think the code
>> bellow should work just fine. However when I click the submit button on my
>> form (after checking the checkbox), the domain model is not updated and the
>> print line in the onSubmit method always returns false.
>>
>> I have watched this code in the debugger and the setSelected method (in
>> domain class) never gets called.  Does anyone have an idea why the code
>> bellow should not work?
>>
>> I have created the following Java code for the view:-
>>
>>    public HomePage() {
>>
>>        MyForm form = new MyForm("form");
>>        add(form);
>>    }
>>
>>    private class MyForm extends Form {
>>
>>        private CheckBoxModel checkBoxModel = new CheckBoxModel();
>>
>>        public MyForm(String s) {
>>            super(s);
>>
>>            CheckBox myCheckBox = new CheckBox("selected",
>>                    new PropertyModel(checkBoxModel, "selected"));
>>            add(myCheckBox);
>>        }
>>
>>        protected void onSubmit() {
>>            boolean bool = checkBoxModel.getSelected();
>>
>>            // I expect this to print true when check box has been clicked
>>            System.out.println(bool);
>>        }
>>    }
>>
>> My domain class is as follows:-
>>
>>   public class CheckBoxModel {
>>
>>        private boolean selected;
>>
>>        public boolean getSelected() {
>>             return selected;
>>        }
>>
>>        public void setSelected(boolean selected) {
>>             this.selected = selected;
>>        }
>>
>>        public String toString() {
>>             return String.valueOf(selected);
>>        }
>>   }
>>
>> Thanks in advance for your help.
>> --
>> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20267081.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Alan Romaniusc <a....@gmail.com>.
I can see no problem in your code. Maybe something else?

On Fri, Oct 31, 2008 at 12:29 PM, ds26680 <ds...@googlemail.com> wrote:
>
> I am new to creating web applications with Wicket and I am struggling with
> getting a CheckBox to set a boolean variable in my domain object using a
> PropertyModel.
>
> I have had a good search around on the web for examples and I think the code
> bellow should work just fine. However when I click the submit button on my
> form (after checking the checkbox), the domain model is not updated and the
> print line in the onSubmit method always returns false.
>
> I have watched this code in the debugger and the setSelected method (in
> domain class) never gets called.  Does anyone have an idea why the code
> bellow should not work?
>
> I have created the following Java code for the view:-
>
>    public HomePage() {
>
>        MyForm form = new MyForm("form");
>        add(form);
>    }
>
>    private class MyForm extends Form {
>
>        private CheckBoxModel checkBoxModel = new CheckBoxModel();
>
>        public MyForm(String s) {
>            super(s);
>
>            CheckBox myCheckBox = new CheckBox("selected",
>                    new PropertyModel(checkBoxModel, "selected"));
>            add(myCheckBox);
>        }
>
>        protected void onSubmit() {
>            boolean bool = checkBoxModel.getSelected();
>
>            // I expect this to print true when check box has been clicked
>            System.out.println(bool);
>        }
>    }
>
> My domain class is as follows:-
>
>   public class CheckBoxModel {
>
>        private boolean selected;
>
>        public boolean getSelected() {
>             return selected;
>        }
>
>        public void setSelected(boolean selected) {
>             this.selected = selected;
>        }
>
>        public String toString() {
>             return String.valueOf(selected);
>        }
>   }
>
> Thanks in advance for your help.
> --
> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20267081.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Alan R.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by Igor Vaynberg <ig...@gmail.com>.
i dont know if what you pasted is your compete source or not, but if
there is a validation error then the model is not updated. add a
feedbackpanel to the page and see if it gets any errors.

further setobject() will not be called on your model, the actuall call
performed will be model.getobject().setselected(true)

-igor

On Fri, Oct 31, 2008 at 12:34 PM, ds26680 <ds...@googlemail.com> wrote:
>
> Thanks for the help so far.
>
> I have fixed the Serialization issue but the problem remains.
>
> My selected variable (domain model) is always false. I have noticed the the
> getObject() method of the PropertyModel gets called but the setModel()
> method (which I believe sets the domain model variable) never gets called. I
> think this is the reason why the selected variable never gets set to true
> when the checkbox is checked and the form is submitted.
>
> I also tried using a CompoundPropertyModel, adding this to the form and
> removed the PropertyModel from checkbox constructor but the domain model
> variable (selected) still does not get set to true.
>
> I tried the suggested change  (new PropertyModel(this,
> "checkBoxModel.selected")); ) but this also did not make any difference.
>
> I am sure I am missing something fundamental here but I not totally confused
> and not sure what to try next. Does anyone else have any ideas what is
> wrong?
>
> Thanks in advance for your help.
> --
> View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20272791.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Help with simple CheckBox example

Posted by ds26680 <ds...@googlemail.com>.
Thanks for the help so far.

I have fixed the Serialization issue but the problem remains.

My selected variable (domain model) is always false. I have noticed the the
getObject() method of the PropertyModel gets called but the setModel()
method (which I believe sets the domain model variable) never gets called. I
think this is the reason why the selected variable never gets set to true
when the checkbox is checked and the form is submitted.

I also tried using a CompoundPropertyModel, adding this to the form and
removed the PropertyModel from checkbox constructor but the domain model
variable (selected) still does not get set to true.

I tried the suggested change  (new PropertyModel(this,
"checkBoxModel.selected")); ) but this also did not make any difference.

I am sure I am missing something fundamental here but I not totally confused
and not sure what to try next. Does anyone else have any ideas what is
wrong?

Thanks in advance for your help.
-- 
View this message in context: http://www.nabble.com/Help-with-simple-CheckBox-example-tp20267081p20272791.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org