Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Problem with internet explorer and website

Options
  • 27-04-2007 10:08am
    #1
    Registered Users Posts: 1,550 ✭✭✭


    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 Posts: 7,468 ✭✭✭Evil Phil


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


  • Registered Users Posts: 1,550 ✭✭✭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 Posts: 38,967 Mod ✭✭✭✭Seth Brundle


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


  • Registered Users Posts: 1,550 ✭✭✭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 Posts: 1,550 ✭✭✭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 Posts: 1,550 ✭✭✭quinnd6


    thanks will give that a go


Advertisement