Re: [WebDNA] Non-numbers entered into a field that asks for a number
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 101587
interpreted = N
texte = Have you tried using JavaScript validation?function isNumeric(elem, errMsg){var numericExpression = /^[0-9]+$/;if(elem.value.match(numericExpression)){return true;}else{alert(errMsg);elem.focus();return false;}}MarcKi Song wrote:> On our add to cart form, we have a text field that requires a customer > to enter the quantity of an item (it defaults to a quantity of 1). If a > customer accidentally enters a letter, or any non-number, it looks like > it converts that non-number to a random number.> > What is the best way to code the page so that the customer can't enter a > non-number into the field?> -- -------------------------------------------Marc ThompsonSoftware EngineerOffice of Information TechnologyUniversity of Utah801.585.9264marc.thompson@utah.edu-------------------------------------------
Associated Messages, from the most recent to the oldest:
Have you tried using JavaScript validation?function isNumeric(elem, errMsg){var numericExpression = /^[0-9]+$/;if(elem.value.match(numericExpression)){return true;}else{alert(errMsg);elem.focus();return false;}}MarcKi Song wrote:> On our add to cart form, we have a text field that requires a customer > to enter the quantity of an item (it defaults to a quantity of 1). If a > customer accidentally enters a letter, or any non-number, it looks like > it converts that non-number to a random number.> > What is the best way to code the page so that the customer can't enter a > non-number into the field?> -- -------------------------------------------Marc ThompsonSoftware EngineerOffice of Information TechnologyUniversity of Utah801.585.9264marc.thompson@utah.edu-------------------------------------------
Marc Thompson
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
So many lookers, hey smith micro (2003)
searching multiple databases in single search (1997)
WebCommerce: Folder organization ? (1997)
Installer needed (2004)
This is an odd error (2001)
HELP WITH DATES (1997)
A question on sub-categories (1997)
Interesting speed comparison .. (2003)
multiple product databases (1997)
Max Record length restated as maybe bug (1997)
Multiple servers and Webcat (1998)
Login Page & [Protect] (2001)
[Sum] function? (1997)
HELP WITH DATES (1997)
what servers are supported for Typhoon? (1997)
Is this possible, WebCat2.0 and checkboxes (1997)
wee problem (2001)
Perl programmer needed [OT] (2002)
carriage returns in data (1997)
Gil's in the lead (1999)