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; } } Marc Ki 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 Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Non-numbers entered into a field that asks for a number (Stuart Tremain 2008)
  2. Re: [WebDNA] Non-numbers entered into a field that asks for a number (Marc Thompson 2008)
  3. Re: [WebDNA] Non-numbers entered into a field that asks for a number (Govinda 2008)
  4. Re: [WebDNA] Non-numbers entered into a field that asks for a number (Ki Song 2008)
  5. Re: [WebDNA] Non-numbers entered into a field that asks for a number (Marc Thompson 2008)
  6. [WebDNA] Non-numbers entered into a field that asks for a number (Ki Song 2008)
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; } } Marc Ki 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 Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.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:

DON'T use old cart file! (1997) [WebDNA] Stock prices in WebDNA? (2017) 'does not contain' operator needed ... (1997) Site Search Concepts (2003) Expiration of Carts (1997) My slower response (1997) automatic reload of frameset (1997) too many nested tags ... (1997) error No such file (2001) How to put the Trademark Symbol (%99) in Sendmail? (2003) FM fields with CR - How to export/import? (2000) Sorting Number with commas (2001) WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997) Logging purchases (1997) Help with Shipping Costs (1997) Setting up shop (1997) Order not created error (never mind) (1997) Looking for a Manual (1997) Share cost of training videos! (1998) Reinstalling (2001)