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 = 101592
interpreted = N
texte = The most simple way to implement this, especially for a qty field is to use an onchange event handler. That way the user can get immediate feed back if they enter something you don't want to allow in that field. Here's an example:
QTY:
Marc Ki Song wrote: > I have not. I may try that ... > > Thanks! > > Marc Thompson wrote: >> 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? >>> >> > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > -- ------------------------------------------- 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)
The most simple way to implement this, especially for a qty field is to use an onchange event handler. That way the user can get immediate feed back if they enter something you don't want to allow in that field. Here's an example:
QTY:
Marc Ki Song wrote: > I have not. I may try that ... > > Thanks! > > Marc Thompson wrote: >> 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? >>> >> > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > -- ------------------------------------------- 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:

WebCat2 beta 11 - new prefs ... (1997) Email and name capture (1999) Banners and sort of random display (1997) [BoldWords] WebCat.acgib15Mac (1997) Javascript Fields of Strawberry Roses and Green Bananas (2000) A question on sub-categories (1997) creating a ShipCosts database (1997) WebCat2b15MacPlugIn - [authenticate] not [protect] (1997) Re:Variable Math (1998) Pre-flight public flag (1997) & Aftermath (1999) What's wrong with this? (2005) X etc.... (1999) Max Record length restated as maybe bug (1997) Some Questions (1997) Some ThankYou page problems (1997) SMSI FTP (2002) Problems reading files created by WC (1997) [addlineitems] (1997) Emailer problem....still (1997)