www.webdeveloper.com
Results 1 to 3 of 3

Thread: Alert if minimum quantity not entered

  1. #1
    Join Date
    Mar 2005
    Location
    UK
    Posts
    45

    Alert if minimum quantity not entered

    HI

    I have an e-commerce site that has some products that have a minimum quantity. At the moment I have multiple items on a page and each product has a simple quantity input field and 'Add to cart' button. Problem is if I set the initial value of the input to 5 where 5 is the minimum and press add to cart it would add every product on that page with the initial value set. So, I want to simply show an alert (stating minimum quantity of 5) if a user inputs 4 or less.

    What is the easiest way to do this? For reference see URL below...

    http://www.ukhomeinteriors.co.uk/con...orn_budget.php

    TIA

    Russ
    "Anyone can make the simple complicated. Creativity is making the complicated simple." Charles Mingus

  2. #2
    Join Date
    Mar 2011
    Posts
    1,145
    The good news is that in the future when browser support for HTML 5 is more robust, you'll be able to employ a pure-HTML solution to this issue. The bad news is that few of the browser vendors seems to be in any hurry to expand their support in this area, so it could be a while.

    In the meantime, you have a couple of options. You can use JavaScript to do validate the user's entries before submitting the form to the shopping cart software. If you search on "JavaScript form validation" you'll find lots of examples. You could also use a <select> list starting with 5 (or 0,5,6,7... to allow for 'none') in place of a text <input>.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Mar 2005
    Location
    UK
    Posts
    45
    Thanks for the reply. I'll check out the validation via JS you spoke about. Bring on the HTML support I say!

    Regards
    "Anyone can make the simple complicated. Creativity is making the complicated simple." Charles Mingus

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles