Community Forums 

Main Content

Re:Quantities changed by Shopper...hmmmm???

    Jan 30 2009 05:49:08

    #1

    Michael Schwab

    Join date : 2008-09-18      Posts : 87

    anon said: The javascript prevents them for putting non-whole numbers into the cart. noqty prevents them from changing them once they are there.

    Add to your form tag:
    onsubmit='return validate_qty(this.qty.value);'

    Add to page head:
    <script type='text/javascript'>
    function validate_qty(qty) {
    if(qty%1 != 0) {
    alert('Quantity must be a whole number');
    return false;
    }
    }
    </script>


    Ok I appreciate your efforts, but you lost me on this one:
    Add to your form tag:
    onsubmit='return validate_qty(this.qty.value);'



    Copy/paste didn't work on this one:
    Add to page head:
    <script type='text/javascript'>
    function validate_qty(qty) {
    if(qty%1 != 0) {
    alert('Quantity must be a whole number');
    return false;
    }
    }
    </script>


    I don't know what I did wrong.