Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Internet Explorer Issues with dynamic select lists in IE7

    I have a select list dynamically populated by a SQL Server database.

    I want to select all items in the list when a particular item is chosen. The code I've written works great in Firefox and I'm assuming other browsers as well. It just doesn't work in IE and specifically tested not working in IE7.

    Any ideas on what I can do to make this work in IE7?

    Here is the code I'm using:

    Select List:
    Code:
    <select name="Literature_MarketID" class="requiredfield" size="13" id="marketList" multiple>
            <option selected="selected" value="">=== Control-click to select multiple items ===</option>
                <%
    While (NOT rsMarkets.EOF)
    %>
                <option value="<%=(rsMarkets.Fields.Item("Markets_ID").Value)%>" id="marketOption_<%=(rsMarkets.Fields.Item("Markets_ID").Value)%>" onClick="checkAll();"><%=(rsMarkets.Fields.Item("Markets_Description").Value)%></option>
                <%
      rsMarkets.MoveNext()
    Wend
    If (rsMarkets.CursorType > 0) Then
      rsMarkets.MoveFirst
    Else
      rsMarkets.Requery
    End If
    %>
              </select>
    Javascript used to select all options when "All" is chosen from the list:
    Code:
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function checkAll()
    {
        var allMarkets = document.getElementById("marketOption_13");
    
                if (allMarkets.selected == true)
                {
                    if (document.getElementById('marketList') != null)
                    {
                        var o = document.getElementById('marketList');
                        for (var i = o.length - 1; i > 0; --i)
                        {
                                o.options[i].selected = true;
                        }
                    }    
                }
    }
    //-->
    </script>

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Jesse Gifford View Post
    Code:
    <option value="<%=(rsMarkets.Fields.Item("Markets_ID").Value)%>" id="marketOption_<%=(rsMarkets.Fields.Item("Markets_ID").Value)%>" onClick="checkAll();">
    I.E. doesn't support onclick for options. Write a handler for the select's onchange event.

  • Users who have thanked Arty Effem for this post:

    Jesse Gifford (08-22-2008)

  • #3
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb

    That did the trick. I actually received that and some additional input in another forum. Here is the link if anyone is interested:

    http://www.tek-tips.com/viewthread.cfm?qid=1495671

    Thanks for your help,
    Jesse


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •