Loading ...
Sorry, an error occurred while loading the content.

How to use Split Buttons with Events?

Expand Messages
  • benny.braeuer
    Hi, I m new to YUI Buttons and the Event-Handling. I have only a simple case, a form with a Split Button (two entries) for submitting (see code below). My
    Message 1 of 3 , Nov 1, 2007
    • 0 Attachment
      Hi,

      I'm new to YUI Buttons and the Event-Handling. I have only a simple
      case, a form with a Split Button (two entries) for submitting (see
      code below).

      My question: What do I need to add to submit the form with the
      selected entry (e.g. subscribe) as a parameter from the Split Button?

      <form method="get" name="subscribe">
      <input type="button" id="optionButton" name="optionButton_button"
      value="Optionen" >
      <select id="optionButtonselect" name="splitbutton2select">
      <option value="subscribe">subscribe</option>
      <option value="unsubscribe">unsubscribe</option>
      </select>
      </form>

      <script>
      var optionButton = new YAHOO.widget.Button("optionButton",
      { type: "split",
      menu: "optionButtonselect"
      });
      </script>

      I tried some of the Examples from documention, but I do not get any
      satisfying result.

      Thanks in advance.

      Cheers,
      Benny
    • Todd Kloots
      Benny - Just change the type attribute of the element to submit and then you split button will automatically submit the form when the user selects
      Message 2 of 3 , Nov 7, 2007
      • 0 Attachment
        Benny -

        Just change the "type" attribute of the <input> element to "submit" and
        then you split button will automatically submit the form when the user
        selects an item from the menu:

        <input type="submit" id="optionButton"
        name="optionButton_button"value="Optionen" >

        - Todd

        benny.braeuer wrote:
        >
        > Hi,
        >
        > I'm new to YUI Buttons and the Event-Handling. I have only a simple
        > case, a form with a Split Button (two entries) for submitting (see
        > code below).
        >
        > My question: What do I need to add to submit the form with the
        > selected entry (e.g. subscribe) as a parameter from the Split Button?
        >
        > <form method="get" name="subscribe">
        > <input type="button" id="optionButton" name="optionButton_button"
        > value="Optionen" >
        > <select id="optionButtonselect" name="splitbutton2select">
        > <option value="subscribe">subscribe</option>
        > <option value="unsubscribe">unsubscribe</option>
        > </select>
        > </form>
        >
        > <script>
        > var optionButton = new YAHOO.widget.Button("optionButton",
        > { type: "split",
        > menu: "optionButtonselect"
        > });
        > </script>
        >
        > I tried some of the Examples from documention, but I do not get any
        > satisfying result.
        >
        > Thanks in advance.
        >
        > Cheers,
        > Benny
        >
        >
      • Benny Bräuer
        Thanks Todd, now it works. :-) Cheers, Benny
        Message 3 of 3 , Nov 13, 2007
        • 0 Attachment
          Thanks Todd, now it works. :-)

          Cheers,
          Benny

          2007/11/7, Todd Kloots <kloots@...>:
          > Benny -
          >
          > Just change the "type" attribute of the <input> element to "submit" and
          > then you split button will automatically submit the form when the user
          > selects an item from the menu:
          >
          > <input type="submit" id="optionButton"
          > name="optionButton_button"value="Optionen" >
          >
          > - Todd
        Your message has been successfully submitted and would be delivered to recipients shortly.