Thursday, 30 July 2015

Oracle ADF - Regular Expression and Attribute validation Notes

Regular Expression for Email validation


if you want to put this for optional field then we have to allow null/empty values as well

So the above expression becomes


^ begin of the string
$ is end of String
| is OR



Regular Expression for Alphanumeric character and also '_' (UnderScore) is allowed

[a-z A-Z 0-9 _]


Regular Expression for Number validation(Only Numbers are allowed not Decimals like 1.5)

[0-9]{1,10}|null

| -> OR
null -> the input text allows null values as well


Attribute validation 

We can perform attribute validation using <af:validateRegExp> component

For Ex, If input text is allowed to have only alphanumeric then put following <af:validateRegExp> within af:inputText component



<af:validateRegExp messageDetailNoMatch="Only alphanumeric, '_'(Underscore) and '-'(Hyphen) characters are allowed" pattern="[a-z A-Z 0-9]*"/>