Announcement

Collapse
No announcement yet.

stupid simple select menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    stupid simple select menu

    I am trying to convert/combine a couple of submit buttons into a single drop down select menu with one submit button (to use on the CTGY page).


    Currently the two buttons are (within the default add to cart form):

    Add to Cart <input type="submit" value="Add to Cart">

    Sample <input type="submit" name="sample" id="samples" value="Order Sample ($1.75ea)" />

    This adds the Sample no matter which option is selected:
    Code:
    <select name="sample" id="samples">
      <option value="Add to Cart">Yards</option>
      <option value="Order Sample ($1.75ea)">Sample</option>
    
    </select>
    This only adds the product.

    Code:
    <select>
      <option value="Add to Cart">Yards</option>
      <option name="sample" id="samples" value="Order Sample ($1.75ea)">Sample</option>
    
    </select>
    The two buttons do work if I don't try to combine them into a dropdown...

    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    A submit button is different from other types of form inputs. The "value" part is not the actual value that gets submitted; it's just the label that appears on the button. Buttons don't submit a value of their own; they just trigger the sending of all the other input values.

    I think the two submit buttons you're looking at must be in two different forms, unless there's some Javascript or something else going on that you didn't mention. If you want to have one form that does two different things, depending on a menu selection, that can be done, but it will require some JavaScript, hidden fields, or other cleverness. If you want some more help with that, you can drop me a line by email.

    HTH --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      In this case that "name" is the trigger - it is tied to module which triggers the specific price for the sample. That's why if I put name="sample" in the select it doesn't matter what is option is selected.
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        That seems like an odd way to do it ... it can probably still be fixed with JS, but I'm reluctant to say any more without seeing all the code.
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          Originally posted by Kent Multer View Post
          That seems like an odd way to do it ... it can probably still be fixed with JS, but I'm reluctant to say any more without seeing all the code.
          Understood. In the mean time, for the CTGY page, I've created a second add to cart button for the sample. It's working but is going to the BASK screen instead of staying on the CTGY screen. Sort of odd since I used the same form code for the button (two separate forms).

          Code:
          <!-- Sample Order Button --> 
           <form action="https://domain.com/Merchant2/merchant.mvc" method="post" id="CatQty1"> <input type="hidden" name="Action" value="ADPR"> <input type="hidden" name="Screen" value="CTGY"> <input type="hidden" name="Attributes" value="Yes"> <input type="hidden" name="Store_Code" value="ABC"> <input type="hidden" name="Offset" value=""> <input type="hidden" name="Product_Code" value="TM-FILGRE"> <input type="hidden" name="Current_Product_Code" value=""> <input type="hidden" name="Category_Code" value="new-fabric"> <input type="hidden" name="Per_Page" value="60"> <input type="hidden" name="Quantity" value="1" > <!-- Sample Ordering --> <div class="samples"> <input type="submit" name="sample" id="samples" value="Order Sample ($1.75ea)" class="sample" /> </div> </form>

          Code:
          <!-- Add to Cart Button --> 
           <form action="https://domain.com/Merchant2/merchant.mvc" method="post" id="CatQty"> <input type="hidden" name="Action" value="ADPR"> <input type="hidden" name="Screen" value="CTGY"> <input type="hidden" name="Attributes" value="Yes"> <input type="hidden" name="Store_Code" value="ABC"> <input type="hidden" name="Offset" value=""> <input type="hidden" name="Product_Code" value="TM-FILGRE"> <input type="hidden" name="Current_Product_Code" value=""> <input type="hidden" name="Category_Code" value="new-fabric"> <input type="hidden" name="Per_Page" value="60"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td>Yards&nbsp;&nbsp;</td><td> <input name="Quantity" type="text" id="Qtybox" value="2" > </td> <td>&nbsp;&nbsp;<input type="image" alt="Add One To Basket" src="graphics/00000001/plusicon.png" border="0"></td> </tr> </table> </form>
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment

          Working...
          X