Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Problem with internet explorer and website

  • 27-04-2007 09:08AM
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    I have this problem with using options within select on a webpage when viewing the webpage on Internet Explorer 7.The page works fine on firefox.
    I have 2 of these drop down lists on the page done using select and options.
    The first drop down list works ok but when I select an option from the first list of options then the second drop down list of options disappears completely.

    What could be causing this?
    Its strange because it works fine on firefox but not on internet explorer.


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Can you post the complete code? It's impossible for anybody to answer your question without it.


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    <table class="changeUser">

    <tr>
    <th>Company:</th>
    <td>
    <select id="ajaxCompanyChooser" onchange="getUserChooserList();" class="changeUserCombo">
    <option>-- Please select a company --</option>
    <%
    Iterator iter = companies.iterator();
    while(iter.hasNext()) {
    %><option><%=iter.next()%></option><%
    }
    %>
    </select>
    </td>
    </tr>
    <tr>

    <th>User:</th>
    <td id="userChooser">
    <select><option> <!-- filled by javascript:getUserChooserList() --></option></select>
    </td>

    </tr>

    </table>


  • Moderators, Politics Moderators, Paid Member Posts: 44,389 Mod ✭✭✭✭Seth Brundle


    Maybe some of the Javascript code for the getUserChooserList function would help!

    Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/ .



  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    function getUserChooserList() {

    if($('ajaxCompanyChooser').selectedIndex == 0) return false;

    $('userChooser').innerHTML = '<select><option>please wait...</option></select>';
    $('changeUserSubmit').disabled = true;

    var chosenClient = $('ajaxCompanyChooser').value;

    var url = "<%=encodedBaseURL%>?view=ajaxgetusers&company="+escape(chosenClient);

    if(window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send(null);
    }
    else if(window.ActiveXObject) { // IE needs slight differences
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req) {
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send();
    }
    }
    }


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    quinnd6 wrote:
    function getUserChooserList() {

    if($('ajaxCompanyChooser').selectedIndex == 0) return false;

    $('userChooser').innerHTML = '<select><option>please wait...</option></select>';
    $('changeUserSubmit').disabled = true;

    var chosenClient = $('ajaxCompanyChooser').value;

    var url = "<%=encodedBaseURL%>?view=ajaxgetusers&company="+escape(chosenClient);

    if(window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send(null);
    }
    else if(window.ActiveXObject) { // IE needs slight differences
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req) {
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send();
    }
    }
    }

    Try this instead:

    function getUserChooserList()
    {
    var the_option;
    if(document.getElementById('ajaxCompanyChooser').selectedIndex == 0) return false;
    else
    the_option = document.getElementById('ajaxCompanyChooser').selectedIndex;
    document.getElementById('userChooser').innerHTML = '<select><option>please wait...</option></select>';
    document.getElementById('changeUserSubmit').disabled = true;

    var chosenClient = document.getElementById('ajaxCompanyChooser').options[the_option].value;

    var url = "<%=encodedBaseURL%>?view=ajaxgetusers&company="+escape(chosenClient);

    if(window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send(null);
    }
    else if(window.ActiveXObject) { // IE needs slight differences
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req) {
    req.onreadystatechange = processReqChange;
    req.open("GET", url, true);
    req.send();
    }
    }


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    Hi thanks for the code but unfortunately it does exactly the same thing.
    I noticed that "please wait" pops up in the second box for a split second when I select an option on the first box then the second box disappears.


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    The only other thing I can think of is that asp hate being referenced inside a script tag. I've run into numerous problems with this over the years. Maybe this line needs to be changed:

    var url = "<%=encodedBaseURL%>?view=ajaxgetusers&company="+escape(chosenClient);


    If you try this instead:

    <%
    Response.write "<scri"
    Response.write "pt>var the_baseURL = """ & encodedBaseURL & """;</script>"
    %>

    Place that code at the top of the page i.e. in the head section of your document
    and replace:
    var url = "<%=encodedBaseURL%>?view=ajaxgetusers&company="+escape(chosenClient);

    with:
    var url = the_baseURL + "?view=ajaxgetusers&company="+escape(chosenClient);


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    thanks will give that a go


Advertisement