0

I have a form with custom email validator like this:

<o:validator for="#{cc.attrs.id}_text" validatorId="emailValidator" disabled="#{not cc.email}" message="#{messages['message.validation.invalidEmail']}" />

And I have a commandButton with ajax=false that submits the form.

On first page post, the email validator error message appears properly. The problem is when submitting the same form twice - I also got 2 invalid email messages. Submit again and you got 3. The problem doesn't occur on other native jsf validator like required and pattern.

For example I submitted the form 3x I will get the messages below:

Email > Invalid format
Email > Invalid format
Email > Invalid format

My bean is conversation scope. Any idea? Thanks.

czetsuya
  • 4,773
  • 13
  • 53
  • 99
  • Please post the context wherein this validator is used, preferably as an SSCCE. I can't reproduce your problem and the usage of the `for` attribute is so strange that I can't think of real world appliances. Are you using this inside a nested composite component? – BalusC Jul 26 '13 at 11:32
  • No feedback? This way you won't be able to get the proper explanation and guidance in the right direction. – BalusC Aug 25 '13 at 14:26

1 Answers1

0

I'm not really sure what happened but the solution that work for me in this case was:

1.) Use f:validator 2.) Create a custom validator and set it to f:validator, example:

I need to hard code email validator as I'm using a custom component. Using a variable doesn't work in this case.

czetsuya
  • 4,773
  • 13
  • 53
  • 99
  • Please note that a custom component is not the same as a composite component. In your question's code example you seem to be actually using a composite component. – BalusC Aug 25 '13 at 14:26