padmapraveen_vasili Posted May 8, 2006 Share Posted May 8, 2006 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 More sharing options...
miteshbhimjiyaani Posted May 9, 2006 Share Posted May 9, 2006 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") }}<{POST_SNAPBACK}> hi can u send me whole code ? one more thing what is document.pos ? Link to comment Share on other sites More sharing options...
Little Goat Posted May 9, 2006 Share Posted May 9, 2006 and finally onBlur='Jscript:validatefield();'<{POST_SNAPBACK}> its not Jscript, its Javascript. use that and it should work Link to comment Share on other sites More sharing options...
padmapraveen_vasili Posted May 11, 2006 Author Share Posted May 11, 2006 hi can u send me whole code ? one more thing what is document.pos ?<{POST_SNAPBACK}> 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 More sharing options...
Webworldx Posted May 11, 2006 Share Posted May 11, 2006 So two alphanumeric and 3 numeric?/\w{2}\d{3}/then check the field length?Edit, just noticed you wanted the extra AB or 12:/(\w{2}\d{3}|\w{2})/ Link to comment Share on other sites More sharing options...
padmapraveen_vasili Posted May 12, 2006 Author Share Posted May 12, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now