[ 
https://issues.apache.org/jira/browse/WICKET-6656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16825095#comment-16825095
 ] 

Sebastian commented on WICKET-6656:
-----------------------------------

Hi Sven,

the changes don't work for us. 
The PropertyValidator still sets "FormComponent#setRequired" to true and in 
this case "FormComponent#validate" just executes a part of the JSR 303 
validations. Therefore the message from "NotNull#message" is ignored.

Is it possible to make PropertyValidator not set "FormComponent#setRequired" to 
true?

Or maybe make "FormComponent#validate" execute all validations if the 
PropertyValidator  implements INullAcceptingValidator? In the moment 
"FormComponent#validate" only executes all JSR 303 validations if 
"FormComponent#isRequired" returns false.

> JSR 303 - @NotNull validation problems 
> ---------------------------------------
>
>                 Key: WICKET-6656
>                 URL: https://issues.apache.org/jira/browse/WICKET-6656
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-bean-validation
>    Affects Versions: 9.0.0-M1, 8.4.0
>            Reporter: Sebastian
>            Assignee: Sven Meier
>            Priority: Minor
>             Fix For: 8.5.0, 9.0.0-M2
>
>
> Hi there,
> we are using JSR 303 validations. But regarding the NotNull validation, the 
> behaviour differs from the other validations.
> On a validation-violation the given message key of NotNull isn't used.
> We recognized, that the method FormComponent.validate() contains a condition 
> to check if the required flag of a FormComponent is set. If the flag is set 
> to true NotNull JSR validations aren't validated.
> On the other hand there is a default validator 
> org.apache.wicket.bean.validation.PropertyValidator (wicket-bean-validation) 
> which sets the required field to true if there is a NotNull validation added 
> to a field.
> If we want to get full JSR 303 support, we need to implement 
> INullAcceptingValidator. But this requires that the required field of 
> FormComponent will always be false.
> The problem is, that we use the required field beside validation for some 
> other functionality in the rendering phase.
> It would be very helpful, if Wicket completly supports JSR 303 without having 
> a restriction on the usage of the FormComponent.
> Do you have a suggestion regarding this issue?
>  
> Thank you.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to