By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,717 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,717 IT Pros & Developers. It's quick & easy.

Cannot get value of drop down box with IE7

P: 1
I have a check in some Perl cgi pages where using some JavaScript to if a drop down box has a value set or not, if not then an alert to the user to select an OU.

The problem I have is that the check works fine in IE8, FireFox and Chrome, but the check does not work in IE7, in IE7 the check always comes back as null.

Expand|Select|Wrap|Line Numbers
  1. <script language=javascript>
  3. function validateData() {
  4.     if ((!(typeof(document.update.ou_new)== "undefined")) && (document.update.ou_new.options[document.update.ou_new.selectedIndex].value == "")) {
  5.         alert("Please select an (ou)");
  6.         return false;
  7.     }
  8.     document.update.submit();
  9.     return true;
  10. }
  11. </script>
Can anyone tell me why the check of:

document.update.ou_new.options[document.update.ou_new.selectedIndex].value == ""

Always comes back empty with IE7 even if there is a value there, in IE8 and others the value comes back as expected.
Feb 21 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Could you post the corresponding HTML code?
Feb 27 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.