Community Forums 

Main Content

Re:Choose 4 from these 8 idea

    Oct 31 2017 09:37:47

    #1

    Alan

    Join date : 2008-09-18      Posts : 2950

    You should be able to achieve your objective with some javascript assistance (not from me - I'm already out of my depth- it's not great js!)

    An elements number is associated with each element in the form. You'll also need some onSubmit code to check mixedqty is a multiple of 12



    <form action="http://wwx.aitsafe.com/cf/add.cfm"; method="post" name="that" id="that">
    ..
    <table>
    <tr><th colspan="2">Mixed dozen<input type="hidden" name="product[]" value="Mixed dozen:," /></th></tr>

    <tr><td>Tuxedo<input type="hidden" name="product[]" value="Tuxedo," /></td>
    <td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>
    <tr><td>Butter<input type="hidden" name="product[]" value="Butter," /></td>
    <td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>
    <tr><td>Nutty<input type="hidden" name="product[]" value="Nutty," /></td>
    <td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>
    <input type="hidden" name="price" value="29.99" />
    </table>
    <br />
    Total <input type="text" name="mixedqty" size="2" />

    <input type="submit" value="Buy mixed dozen" />
    </form>

    the above would give a cart line such as

    Mixed dozen: Tuxedo 3, Butter 4, Nutty 5

    P.S. - it would also show all of the other options with qty 0.

    Alan
    Some shipping help documents are available at www.stoner.org.uk/mals/