Hi guys,
I am developing an application which takes consumer_id from our employees and searches them from database if consumer_id match is found his details are available...
Now I have managed to validate the text field to numeric only..ie: It will accept numbers only..If anyone presses alphabets or special characters it wil not type in the filed...
Once consumer_id is entered and find is clicked it will search through database & if match is found it will display details of consumer or if no match is found it will throw an alert and return to homescreen..
Problem occurs when I copy paste.. If I copy paste nos...it still works.If wrong consumer_id(nos . only) is pasted it still throws alert..
But if I copy/paste alphabets or special characters with/without nos... It gives Sql exception error...
Now I cannot disable copy/paste it is required bcoz consumer_id is 7 digit and it will be provided to them via email to check....
I also know I have to create a function for validating copy/paste and call it onblur/onchange/onsubmit...
But I don't know how to start or how to validate it..nothing comes to mind...
Although our staff is not stupid enough to enter alphabet/special characters in the id field but it does look pathetic from apllication development point of view... Imagine in gmail if you tried using * in username and it gave you exception error...
I am developing an application which takes consumer_id from our employees and searches them from database if consumer_id match is found his details are available...
Now I have managed to validate the text field to numeric only..ie: It will accept numbers only..If anyone presses alphabets or special characters it wil not type in the filed...
Once consumer_id is entered and find is clicked it will search through database & if match is found it will display details of consumer or if no match is found it will throw an alert and return to homescreen..
Problem occurs when I copy paste.. If I copy paste nos...it still works.If wrong consumer_id(nos . only) is pasted it still throws alert..
But if I copy/paste alphabets or special characters with/without nos... It gives Sql exception error...
Now I cannot disable copy/paste it is required bcoz consumer_id is 7 digit and it will be provided to them via email to check....
I also know I have to create a function for validating copy/paste and call it onblur/onchange/onsubmit...
But I don't know how to start or how to validate it..nothing comes to mind...
Although our staff is not stupid enough to enter alphabet/special characters in the id field but it does look pathetic from apllication development point of view... Imagine in gmail if you tried using * in username and it gave you exception error...
Comment