You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edvin Syse <ed...@sysedata.no> on 2008/01/05 16:07:31 UTC

More CheckBox.setRequired() agony :)

Hi!

In regards to my earlier post concerning this:

http://www.nabble.com/Bug-in-1.3-final%3A-CheckBox.setRequired%28%29-is-not-picked-up-as-error-when-unchecked-to14619181.html

I suddenly got the reverse problem: When I have a checkbox like this:

      CheckBox agree = new CheckBox("agree", new Model()) {
     	 @Override public boolean checkRequired() {
     		return false;
     	}
      };
      agree.setRequired(true);

.. I get the error "Field 'agree' is required." even when I check the box. This is driving me crazy :) What am I doing wrong? I could swear 
that it worked earlier :)

Sincerely,
Edvin Syse

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


Re: More CheckBox.setRequired() agony :)

Posted by Edvin Syse <ed...@sysedata.no>.
Thanks, got it :) I misunderstood the point of the checkRequired() method earlier :)

-- Edvin

Igor Vaynberg skrev:
> erm, spoke too soon
> 
> boolean checkRequired() { if (isRequired()) { return
> !Strings.isEmpty(getInput()); }}
> 
> -igor
> 
> 
> On Jan 5, 2008 8:58 AM, Igor Vaynberg <ig...@gmail.com> wrote:
>> boolean checkRequired() { return
>> Boolean.TRUE.equals((Boolean)getModelObject()); }
>>
>> -igor
>>
>>
>>
>> On Jan 5, 2008 7:07 AM, Edvin Syse <ed...@sysedata.no> wrote:
>>> Hi!
>>>
>>> In regards to my earlier post concerning this:
>>>
>>> http://www.nabble.com/Bug-in-1.3-final%3A-CheckBox.setRequired%28%29-is-not-picked-up-as-error-when-unchecked-to14619181.html
>>>
>>> I suddenly got the reverse problem: When I have a checkbox like this:
>>>
>>>       CheckBox agree = new CheckBox("agree", new Model()) {
>>>          @Override public boolean checkRequired() {
>>>                 return false;
>>>         }
>>>       };
>>>       agree.setRequired(true);
>>>
>>> .. I get the error "Field 'agree' is required." even when I check the box. This is driving me crazy :) What am I doing wrong? I could swear
>>> that it worked earlier :)
>>>
>>> Sincerely,
>>> Edvin Syse
>>>
>>> ---------------------------------------------------------------------
>>> 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
> 


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


Re: More CheckBox.setRequired() agony :)

Posted by Igor Vaynberg <ig...@gmail.com>.
erm, spoke too soon

boolean checkRequired() { if (isRequired()) { return
!Strings.isEmpty(getInput()); }}

-igor


On Jan 5, 2008 8:58 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> boolean checkRequired() { return
> Boolean.TRUE.equals((Boolean)getModelObject()); }
>
> -igor
>
>
>
> On Jan 5, 2008 7:07 AM, Edvin Syse <ed...@sysedata.no> wrote:
> > Hi!
> >
> > In regards to my earlier post concerning this:
> >
> > http://www.nabble.com/Bug-in-1.3-final%3A-CheckBox.setRequired%28%29-is-not-picked-up-as-error-when-unchecked-to14619181.html
> >
> > I suddenly got the reverse problem: When I have a checkbox like this:
> >
> >       CheckBox agree = new CheckBox("agree", new Model()) {
> >          @Override public boolean checkRequired() {
> >                 return false;
> >         }
> >       };
> >       agree.setRequired(true);
> >
> > .. I get the error "Field 'agree' is required." even when I check the box. This is driving me crazy :) What am I doing wrong? I could swear
> > that it worked earlier :)
> >
> > Sincerely,
> > Edvin Syse
> >
> > ---------------------------------------------------------------------
> > 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: More CheckBox.setRequired() agony :)

Posted by Igor Vaynberg <ig...@gmail.com>.
boolean checkRequired() { return
Boolean.TRUE.equals((Boolean)getModelObject()); }

-igor


On Jan 5, 2008 7:07 AM, Edvin Syse <ed...@sysedata.no> wrote:
> Hi!
>
> In regards to my earlier post concerning this:
>
> http://www.nabble.com/Bug-in-1.3-final%3A-CheckBox.setRequired%28%29-is-not-picked-up-as-error-when-unchecked-to14619181.html
>
> I suddenly got the reverse problem: When I have a checkbox like this:
>
>       CheckBox agree = new CheckBox("agree", new Model()) {
>          @Override public boolean checkRequired() {
>                 return false;
>         }
>       };
>       agree.setRequired(true);
>
> .. I get the error "Field 'agree' is required." even when I check the box. This is driving me crazy :) What am I doing wrong? I could swear
> that it worked earlier :)
>
> Sincerely,
> Edvin Syse
>
> ---------------------------------------------------------------------
> 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