Hello, i am trying to add a validation in java depending on the values from the back end.

For example, if the field's "type" value is 1, then i want the field "identity" to accept numbers only, otherwise, ot can hold any letter. I've tried to add an attribute to the field in my backend like:

So, when combobox "type" changes and sets the param value to 1 or 0 (simplified), then maxlength is changed as in sample code, but it should also validate if the value is numbers only (when param = 1) or alphanumeric otherwise.

Comments

I can not comment on @chillworld answer, but the idea is to use dynamic client validation so that i don't have to say "it will validate it later", i don't know how to accomplish this with the visible attribute?

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!