• The normal way to do this is to use regular expressions. Regular expressions allow you to specify a pattern which the data must match... if it doesn't match, you put out an error message. You would need to know the logical rules for what constitutes a valid customer number in your application. You would also need to know a bit about regular expressions. Another way to do it is to write logic which tests each character in the string, and otherwise verifies whatever rules you need to enforce. That's more time consuming and error-prone than using regular expressions, but it has the advantage of not requiring you to understand regular expressions.
  • 1) Let the type their name and if they only use caps, reject them. ;-) 2) for a serious answer, look at that from Stableboy. You could also check against a database and get the customer record by the process.
  • if you are using ASP.Net. Then you can use regular expression validator and required field validator for customer number field. eg regular expression for SSN: d{3}-d{2}-d{4}
  • You should use the regular expression validator. There are also more regular expression such e-mail validator supported by the regular expression validator.

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy