Jump to content

regExp code in the jsp


Recommended Posts

hi...the code given by scott is working fine..but when i put the code in the jsp..its not working properly..for every input iam getting negative error "invalid entry"i have seprate function for length validationand finally onBlur='Jscript:validatefield();'function validatefield(){ var tomatch=/[A-Za-z0-9]\w{1,}[0-9]\d{2}/ if(tomatch.test(document.pos)) { alert("valid entry for the field") } else { alert("Invalid entry to field") }}

Link to comment
Share on other sites

hi...the code given by scott is working fine..but when i put the code in the jsp..its not working properly..for every input iam getting negative error "invalid entry"i have seprate function for length validationand finally onBlur='Jscript:validatefield();'function validatefield(){  var tomatch=/[A-Za-z0-9]\w{1,}[0-9]\d{2}/        if(tomatch.test(document.pos))        {          alert("valid entry for the field")        }      else         {          alert("Invalid entry to field")        }}

hi can u send me whole code ? one more thing what is document.pos ?
Link to comment
Share on other sites

hi can u send me whole code ? one more thing what is document.pos ?

yes friend...that document is the field POS value is got there to check...i need a script to validate the field such that it should accept two char ALPHANUMERIC and will take the rest numeric..for example: it can be 12345 AB123 1B234 A2345 or simply can take AB 12...and little goat i have used the on blur call for validation..its working..but i am not able to satisfy the above given requirement..please let me know if you need any other calrifications....
Link to comment
Share on other sites

hi blue...sorry i think i have confused you guys...i also need to restrict the special characters also...ie only A-Z a-z 0-9only the first two positions can allow the alpha numeric..and the rest three numeric..i can enter the follwing type values...AB12A23451B345AB345and the main thing here is that..minium of two characters must me entered..the rest three is not mandatory..so please do pardon for the mail i sent to you all..and here is my actual problem..help me out guys..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...