Mal's E-commerce script examples

It is assumed that you know how to format a Mal's-E form - use the help pages at Mal's E-Commerce if not
Three different quantity/order methods are also presented, but are not exclusive to the options they are shown with
You may also omit the - Choose - entry on the others, or add it to the last, just be careful to keep the price values in step.
  1. Using Select for all, no heading script required. Only the numbers of items defined by the select may be ordered
    Order:

  2. Using TextBox for price (IE attribute - READONLY could possibly be added) and a checkbox to order one (and only one)
    This uses the array in the header to provide values for the textbox
    Order:

  3. Using HIDDEN for price and a checkbox to order one (and only one)
    This borrows item 2's array in the header to provide values - you would need an array for each set of values
    Looks like the non-script example 4, but delivers a cleaner result to the cart
    Also needs no protect code for the price box, as there isn't one
    Order:

  4. Non-script solution - only a different PRICE is sent to cart. Also uses simple text box for quantity
    Order:
You could generate a page with a form in OPTION 4 method, and in the header, you place a script to direct you to a second page using OPTION 3 - this neatly side-steps the problems of non-Javascript enabled browsers, since they will remain on the compatible page.
Script wizards may be tempted to put the non-script version into a NOSCRIPT tag pair, and write the entire Javascript version from Javascript - personally I think that's far too awkward.
e.g.
<SCRIPT>
location.href = "page_scripted.htm"
</SCRIPT>

How it works

The "onChange" sets the index (position) of the price list to match the Product whenever it is changed
The "onFocus" pushes the select back to the product, so the price cannot be changed
A trick here is that the warning displayed by ALERT prevents double-clicks from breaking through, otherwise the same function must be applied to "onDblClick" as well.
The second example shows the use of an ARRAY to provide values for a TEXT or HIDDEN field.

This code fragment may be freely used, or added to Mal's archives if desired. Please remember, there may be browser version dependencies, and if Javascript is disabled, it will return incorrect cart values!
Please note - while I have used "THIS" and "THIS.FORM" to eliminate the form name, the field name does appear, so do not copy the code to multiple fields without editing - tattoo this on your brain, or YOU WILL FORGET!

And Finally - No attempt has been made to format things neatly - the form doesn't even have a submit button.
This is example code only, no liability accepted for any defect, malfunction, damage, pestilence, famine, war or any other matter arising or not from it's use.