On 7/8/07, Thies Edeling <[EMAIL PROTECTED]> wrote:

 Apparently setType on a FormComponent (needed for NumberValidator) sets
the required flag for primitive types. With the required flag set a null
field never makes it to my validator.
Why does setType set the required flag for primitives?

    /**
     * Sets the type that will be used when updating the model for this
     * component. If no type is specified String type is assumed.
     *
     * @param type
     * @return this for chaining
     */
    public final FormComponent setType(Class type)
    {
        this.typeName = type == null ? null : type.getName();
        if (type != null && type.isPrimitive())
        {
            setRequired(true);
        }
        return this;
    }


looks like a bug to me. im sure someone had something in mind though - a
weird thing to do. who committed that?

-igor



Jonathan Locke wrote:

oh, i should mention that my wicket is not head.  it was frozen a couple
weeks back, so it's possible this is a regression.  you might want to look
at the revision history for the various classes involved in validation.


Jonathan Locke wrote:

 maybe this is a bug?  i have a ConstrainedPropertyValidator which extends
AbstractValidator (which implements INullAcceptingValidator) and returns
true for validateOnNullValue() and it works just fine.  you might need to
trace into the validation code to figure out why it's not calling your
validator.


Thies Edeling wrote:

 Hi

How can I have a NumberValidator allow null values ? I tried extending
the DoubleRangeValidator, implement the INullAcceptingValidator
interface and returning true for validateOnNullValue but my Validator
still isn't called. Also not setting the required property on a
TextField won't give help, when going through the visitFormComponents
the FormComponent is still listed as not valid when no value is provided
in the form. Thanks.

gr,
Thies


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[EMAIL PROTECTED]://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to