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:
emailer 150 (1997)
Date stamp and purging (1998)
Re:quit command on NT (1997)
Resume Catalog ? (1997)
checkout.tpl (1999)
How do I ad to an existing cart? (2000)
Passing Variables.. yikes, I'm dumb (2000)
emailer setup (1997)
What is wrong here? (2000)
Sorting LISTFILES (1997)
Universal db access template ... (2002)
request for comment tag (1998)
Initiating NewCart (1997)
Webcat causing crashes left and right! (1997)
HTML Editors (1997)
WC2b15 - [HTMLx]...[/HTMLx] problems SOLVED! (1997)
Auto entering Friday's date in a field (2002)
[GROUPS] followup (1997)
Search design (1997)
UPDATE PROBLEM (1997)