But the javadoc says:

public boolean checkRequired()
"Checks if the form component's 'required' requirement is met. This
method should typically only be called when FormComponent.isRequired()
returns true."

And I agree with javadoc :)
checkRequired () should be called only to know "if the form
component's 'required' requirement is met". In case isRequired()
returns false this call does not make any sense...

   Basically if isRequired () returns true you know that a component
is required but what you don't know is whether the requirement
condition is met or not and so to check it out you call checkRequired
(). checkRequired () shouldn't call isRequired () itself.

On Wed, Mar 19, 2008 at 10:39 PM, Johan Compagner <[EMAIL PROTECTED]> wrote:
> it checks if the required needs to be checked and if that is the case it
>  checks if the input is set
>
>
>  On Wed, Mar 19, 2008 at 10:32 PM, Vitaly Tsaplin <[EMAIL PROTECTED]>
>
>
> wrote:
>
>  >  checkRequired () itself shouldn't be called at all unless
>  > setRequired is true...
>  >
>  > On Wed, Mar 19, 2008 at 9:43 PM, Johan Compagner <[EMAIL PROTECTED]>
>  > wrote:
>  > > and did you look at checkRequired?
>  > >
>  > >  public boolean checkRequired()
>  > >     {
>  > >         if (isRequired())
>  > >         {
>  > >
>  > >  On Wed, Mar 19, 2008 at 2:24 PM, Vitaly Tsaplin <
>  > [EMAIL PROTECTED]>
>  > >  wrote:
>  > >
>  > >
>  > >
>  > >  >   Hi guys,
>  > >  >
>  > >  >   According to the wicket javadoc the method checkRequired () of the
>  > >  > FormComponent class "...should typically only be called when
>  > >  > isRequired() returns true."
>  > >  >   But it seems to be different...
>  > >  >
>  > >  >        public final void validate()
>  > >  >        {
>  > >  >                validateRequired();  <<<-------------------- here
>  > >  >                if (isValid())
>  > >  >                {
>  > >  >                        convertInput();
>  > >  >
>  > >  >                        if (isValid() && isRequired() &&
>  > >  > getConvertedInput() == null &&
>  > >  > isInputNullable())
>  > >  >                        {
>  > >  >                                reportRequiredError();
>  > >  >                        }
>  > >  >
>  > >  >                        if (isValid())
>  > >  >                        {
>  > >  >                                validateValidators();
>  > >  >                        }
>  > >  >                }
>  > >  >        }
>  > >  >
>  > >  >        protected final void validateRequired()
>  > >  >        {
>  > >  >                if (!checkRequired())   <<<--------------------- and
>  > here
>  > >  >                {
>  > >  >                        reportRequiredError();
>  > >  >                }
>  > >  >        }
>  > >  >
>  > >  >   As you can see the checkRequired () is called unconditionally.
>  > >  >
>  > >  >   Vitaly
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > 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]
>  >
>  >
>

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

Reply via email to