Solved

My dropdown isn't working in firefox...

Posted on 2007-11-14
5
912 Views
Last Modified: 2008-02-01
My dropdown code DOES work in firefox...I got it off the boards here and BY itself it works GREAT...
but if I put it within MY drop down it doesn't work...just flickers...
HERE is the original code...IT ROCKS...<html>
<head>
<script type="text/javascript">
<!--
function selChk(obj) {
      if(obj.value!='nosel') {
            var rs = document.getElementsByName('rad');
            for(i=0; i<rs.length; i++){
                  rs[i].disabled = false;
            }
            if(rs.length>0) rs[0].focus();
      } else {
            var rs = document.getElementsByName('rad');
            for(i=0; i<rs.length; i++){
                  rs[i].disabled = true;
                  rs[i].checked = false;
                  rs[i].blur();
            }
      }
}

function frmChk(){
      var rs = document.getElementsByName('rad');
      var chk = false;
      for(i=0; i<rs.length; i++){
            if(rs[i].checked) return true;
      }
     
      alert('You must select one of the choices!');
      return false;
}
//-->
</script>
</head>
<body>
<form onsubmit="return frmChk();">
The Select Box:
<select id="sel" onchange="selChk(this);">
      <option selected value="nosel">Select A Value
      <option value="val">Value
      <option value="val2">Value 2
</select>
<br><br>
The Radio Buttons:<br>
<input type="radio" name="rad" disabled> Choice 1&nbsp;&nbsp;<input type="radio" name="rad" disabled> Choice 2
<br><br>
The Submit Button: <input type="submit" value="Submit!">
</form>
</body>
</html>


****************************
THIS DOES NOT WORK
****************************

<select size="1"  name="assignOwner"  tabindex="2" id="sel" onchange="selChk(this);">
           
           
 <%
  ' this needs to be changed to allow for grouplead of 1
 
 if deptlead = 0 then
dim mRSa
dim mRS1a


set mRSa = server.createobject("ADODB.Recordset")
mRSa.Open "SELECT DISTINCT deptGroup from EmpDB where active='1' and support='1' and (Business = 'Drake Software' or business = 'Dnet') order by deptGroup", Conn

set mRS1a = server.createobject("ADODB.Recordset")

response.write "<option value=none selected  tabindex=3 >Select associate to assign this call to:</option>"
do while not mRSa.EOF
   response.write "<option value="& mRsa.fields("deptGroup") &"  tabindex=4 >------:" & mRsa.fields("deptGroup") & ":------</option>"
   mRS1a.Open "select * from EmpDB where deptGroup='" & mRsa.fields("deptGroup") & "' and (Business = 'Drake Software' or business = 'Dnet') and support ='1' and active ='1' Order By fname, lname", Conn
   do while not mRS1a.EOF%>
          <option value=<%= mRS1a("login")%>  tabindex="5" ><%= mRS1a("fName")%>&nbsp;<%= mRS1a("lName")%></option>
         <%'response.write "<option  tabindex="6" >" & mRS1a.fields("fname") & "</option>"
         mRS1a.Movenext
   loop
  mRS1a.Close
  mRSa.Movenext
loop
%>
</select>

<% set mRS1a = Nothing
mRSa.Close
set mRSa = Nothing

  ' this needs to be changed to allow for grouplead of 1
 
dim mRSa1

else

set mRSa1 = server.createobject("ADODB.Recordset")
mRSa1.Open "SELECT * from EmpDB where active='1' and support='1' and (Business = 'Drake Software' or business = 'Dnet') and deptgroup='" & DeptRSS & "'", Conn

response.write "<option value=none selected  tabindex=3 >Select associate to assign this call to:</option>"
do while not mRSa1.EOF
   response.write "<option value="& mRsa1.fields("login") &"  tabindex=4 >" & mRsa1.fields("fname") & "&nbsp;"& mRsa1.fields("lname") & "</option>"
 
  mRSa1.Movenext
loop
%>
</select>
<%

mRSa1.Close
set mRSa1 = Nothing
end if
%>
0
Comment
Question by:tsmithinnc
  • 3
5 Comments
 
LVL 17

Expert Comment

by:gops1
ID: 20282514
Not sure what is this piece of code trying to achieve:

else {
            var rs = document.getElementsByName('rad');
            for(i=0; i<rs.length; i++){
                  rs[i].disabled = true;
                  rs[i].checked = false;
                  rs[i].blur();
            }

0
 
LVL 17

Expert Comment

by:gops1
ID: 20282529
Sorry for my previous comment. I misread the code
0
 
LVL 17

Expert Comment

by:gops1
ID: 20282551
In your code do you have this check?

  if(obj.value!='nosel') {
.....
...
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 20282630
Hi,
Three questions:
1) Is the select embedded within a form?
2) What does FF's Error Console (Tools) say the problem is?
3) What does the 'rendered code" look like?  We don't really need tosee actual data (login info), but the html tags would help.  (IE & Asp tend to be somewhat lax in W3 standards)
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
ID: 20283333
the element <option> does not have an attibute 'tabindex' the select object does
and i think your issue is related to your default
response.write "<option value=none selected  tabindex=3 >Select associate to assign this call to:</option>"

the code is looking for a default of 'nosel'
 if(obj.value!='nosel') {
you have it as none
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question