3 Replies Latest reply on Apr 26, 2007 6:21 AM by Newsgroup_User

    setting List Menus

    Level 7
      Hi Again All

      Here's my problem. I need an onclick or onchange event to reset the opposite
      form to the first value in the list.
      E.G.

      if I select Option 1 from FORM1 then go to FORM2 I need FORM 2 to trigger an
      event that resets FORM1 back to 0 or the first element in it's list

      <select name="FORM1">
      <option value="0" selected="selected">Option 0</option>
      <option value="1" selected="selected">Option 1</option>
      <option value="2" selected="selected">Option 2</option>
      </select>

      <select name="FORM2">
      <option value="0" selected="selected">Option 0</option>
      <option value="1" selected="selected">Option 1</option>
      <option value="2" selected="selected">Option 2</option>
      </select>

      I'm guessing a javascript solution would be easy but not for me :-).
      Actually, if anyone knows of a cfscript solution that would be great.

      TIA

      Bill


        • 1. Re: setting List Menus
          Daverms Level 3
          Like this,

          • 2. Re: setting List Menus
            cf_dev2 Level 1
            You don't want cfscript because it would require a trip back to the server. You can use javascript to reset the selected index of the opposite list object. Something like this

            • 3. Re: setting List Menus
              Level 7
              Thanks guys.

              That worked perfectly.

              Bill


              "cf_dev2" <webforumsuser@macromedia.com> wrote in message
              news:f0plkg$4o2$1@forums.macromedia.com...
              > You don't want cfscript because it would require a trip back to the
              > server.
              > You can use javascript to reset the selected index of the opposite list
              > object.
              > Something like this
              >
              >
              >
              > <script type="text/javascript">
              > function selectFirstListItem(listId) {
              > var listObj = document.getElementById(listId);
              > //javascript indexes are zero based. 0 is the index of the
              > first list item
              > listObj.selectedIndex = 0;
              > }
              > </script>
              > <form>
              > <select name="LIST1" id="list1" onFocus="selectFirstListItem('list2');">
              > <option value="0" selected="selected">Option 0</option>
              > <option value="1">Option 1</option>
              > <option value="2">Option 2</option>
              > </select>
              >
              > <select name="LIST2" id="list2" onFocus="selectFirstListItem('list1');">
              > <option value="0" selected="selected">Option 0</option>
              > <option value="1">Option 1</option>
              > <option value="2">Option 2</option>
              > </select>
              > </form>
              >