Set Min/Max Quantities.



All this simple JavaScript (JS) plugin does is to allow you to set min and/or max values for the quantity variable within FORMs. It makes sure that you cannot violate the limits you establish within a single order. Of course, the user may place the order more than once, or change the quantity once within the PayPal cart - there is no way to protect against this in the normal HTML-to-PayPal interface.

If you have single items for sale you might consider Ebay, else you must generate your customer's HTML page from your server based on current inventory. And when an item is ordered, then you must go to your server, withdraw that item from inventory, and reload the page so it does not include that item any longer. You must also take steps to ensure that the quantity cannot be changed once within PayPal - that requires a 3rd party cart, PERIOD!

We start with the output of the PayPal button factory and make a few changes. Then the JS processes the FORM and adjusts the fields. Right-click on this page (and <view source>) to see what was done.

  • Copy the JS from this example and paste it into your page within the <head> section, like is done on this page, or into the <body> section. Only one copy of the JS is needed for any page.
  • If you want a view-cart button somewhere on the page you must copy the view FORM from my page and insert it into your page right after the <body... statement like I have done here. You will need to change the business value, or course. More info
  • Go into every FORM where you want to set limits, and add either/both a maxqty or minqty setting to the onsubmit event handler, and return the value of the call to the ChkQty function (like is done here (<view source> to see what I did here).



This FORM sets a minimum value of 3, and a maximum value of 10 items that may be ordered. You may set either, neither, or both, limits...

Input Quantity >  



Back To Main Page



info@capleswebdev.com