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

Rene O commented on MYFACES-3892:
---------------------------------

Your solution works, but generally mixing of Bean-Validation and JSF-Validation 
leads to another problem:
{code}
<h:inputText id="myfield" value="#{myBean.myField}">
        <f:validateBean />
        <f:validateRegex pattern="[A-Z]" />
</h:inputText>
<h:message for="myfield" />
{code}
{code}
MyBean {

        @NotNull
        @Size(min=6,max=10)
        String myField;
        ...
}
{code}
=> user input: 1234

If beanvalidation fails and the regex fails, then there occurs a warning from 
the regexvalidator, because messagefield is already used by 
beanvalidationmessage:
GUI:
{noformat}
        muss zwischen 6 und 10 liegen 
{noformat}
Log:
{noformat}
        Warnung: There are some unhandled FacesMessages, this means not every 
FacesMessage had a chance to be rendered.
        These unhandled FacesMessages are: 
        - myField: Der eingegebene Wert ([A-Z]) ist nicht korrekt.
{noformat}
        
Can I prevent this warning?

> Create a option to execute BeanValidation before JSF-Validation
> ---------------------------------------------------------------
>
>                 Key: MYFACES-3892
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3892
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.2.3
>            Reporter: Rene O
>
> As stated in this answer: http://stackoverflow.com/a/19835645 BeanValidation 
> is executed after JSF-Validation.
> But it would be very useful to have a way to change this behaviour.
> Now you can't decide within jsf-validator wether a component is valid or not 
> in terms of BeanValidation
> {code}
> //My JSF-Validator
> //...
> UIInput input = (UIInput) component;
> if (!input.isValid()) {
>     return;
> }
> //...my own jsf-validation rules...
> //...
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to