Community Forums 

Main Content

Re:form with lots oif text boxes & drop downs. help needed

    Apr 15 2013 12:34:05

    #1

    Claire

    Join date : 2008-11-08      Posts : 90

    When qty is in a line with <option ></option > the item does not get added to the cart - only when the user selects it. That is good in this case. Like in this sample. try this sample, select a size and fill in option #2 only then add to cart. No extra items are added.
    http://www.outdoortrailgear.com/co-op-details/weightbelt-no-text-boxes.html

    But this is the form I want to use. Try this one. Select size and fill in option #2 only. Then add to cart. You will see blank items sent to cart. This is caused by the text boxes.
    http://www.outdoortrailgear.com/co-op-details/custom-weightbelt.html

    My question. If user does not choose option with text boxes - any way to stop it from sending a blank item to cart? Am I doing text boxes correctly? Is there something I can do different to get the same result?

    Thank you!

    Alan said If you have a product and a qty a line will be added to the cart.

    If something is free, don't create a new product; make the text an option on an existing product.

    General rules on commas seem to be that the cart adds a comma BEFORE a second or subsequent product[] value UNLESS the previous value ended with a comma.

    So you can put commas in all but the last value. Treat a set, such as the drop down, as an entity.

    To avoid one after a text box

    <input type="text" name="product[]" value="" id="thisone" onChange="thisone.value = thisone.value+','" />

    But it's messy in that the customer may spot the added comma in the text box as he completes the form.

    ----
    Claire Walters Design Studios