How to validate regular expression when tab out in jsf/Icefaces

249 views Asked by At

I want to validate a text field ( whether it contains special characters in the text) . I want to validate immediately when user tab out of the text field not on submit button. How to achive it using Icefaces 1.8 or JSF 1.2 ?

Below is the tag I have tried but it is working on submit button only

<f:validateRegex pattern="((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})" />
1

There are 1 answers

0
Artur Skrzydło On BEST ANSWER

You could move validation from jsf attribute to javascript. To do this you should add onblur attribute to your inputtext component as following :

<h:inputText onblur="validate()">

where validate() should be javascript method where you implement validation.