?
Solved

Dependent Drop-Down: Netscape Problem

Posted on 2003-11-07
11
Medium Priority
?
238 Views
Last Modified: 2006-11-17
Hi guys..

I'm using the following code which works for IE but not Netscape 4. Anyone have any ideas?  Thanks

-------------------------------------------------------------------------------------------------------------------[code here]
<head>
<script language="javascript">
<!--

var arr1=new Array();

<?php
$query = "SELECT * FROM tbl_personals_provinces WHERE pprov_active = 1";
$qsProvinces = mysql_query($query) or die("The query failed. ".mysql_error());

$query = "SELECT * FROM tbl_personals_countries WHERE pcountry_active = 1";
$qsCountries = mysql_query($query) or die("The query failed. ".mysql_error());

$p = 0;
while($row1=mysql_fetch_array($qsProvinces)){
    echo "arr1[".$p."]=new Array();";
    echo "arr1[".$p."][0]='".$row1["pprov_id"]."';";
    echo "arr1[".$p."][1]='".$row1["pprov_name"]."';";
    echo "arr1[".$p."][2]='".$row1["pprov_countryID"]."';";
    $p = $p+1;
}
?>

function setDynaList(f){
         var win = window.document.frm_quickSearch;
         var k=0;
         n = f.options[f.options.selectedIndex].value;
         common = win.qs_provState;
         common.length=arr1.length
 
         common.options[k] = new Option("Search All",'');
             k=1;
         for(i=0;i<arr1.length;i++){
                    if(n==arr1[i][2]){              
               common.options[k] = new Option(arr1[i][1],arr1[i][0]);
              k=k+1;
              }
         }

         common.length=k;
             if(common.length == 0)
             {
             common.options[k] = new Option("Search All",'');
             }
}
//-->
</script>
</head>

<body onLoad="setDynaList(window.document.frm_quickSearch.qs_country)">

[other code stripped...]

<select name="qs_country" style="width:130px" class="p_qsBox" id="qs_country" onchange="setDynaList(window.document.frm_quickSearch.qs_country)">
<option value="">Search All</option>
<?php while ($row = mysql_fetch_array($qsCountries)){ ?>
     <option value="<?php Print $row["pcountry_id"];?>"><?php Print $row["pcountry_name"];?></option>
<?php } ?>
<option value="1000">Rest of the world</option>
</select>


<select name="qs_provState" style="width:130px" class="p_qsBox" id="qs_provState"></select>


</body>
0
Comment
Question by:bloodtrain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 2

Author Comment

by:bloodtrain
ID: 9700692
ok, for the qs_provState, I added 1 option called Search All to see how NS would react and it did *something* atleast. My code kind of works now except that the qs_provState dropdown is fu*@ed up when clicked on.  It makes another 2 buttons that you have to scroll through.

I don't know if you understand what I am talking about so I took a screenshot! :)

http://www.ezoi.net/ns_error.gif


Thanks!
0
 
LVL 5

Expert Comment

by:Karitz
ID: 9700962
that appears whenever there is a multiple select option like.

<select name="qs_provState" size="1" multiple class="p_qsBox" id="qs_provState" style="width:130px"></select>

check that
0
 
LVL 2

Author Comment

by:bloodtrain
ID: 9701001
well, I don't have that anywhere in my code unless I'm completely blind! :)

I've experienced this exact same problem with another site I was building a few months ago. I never found the problem with that either! :(

Plus I was using code from Macromedia:

http://www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listbox.htm

There must be some kind of solution..
0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
LVL 2

Author Comment

by:bloodtrain
ID: 9701018
oops.. scratch that last comment about Macromedia's code! hehe.. I meant to say that I had that same problem with code someone from EE gave me. There's something in the macromedia code that makes it work for NS. But I don't know what! Maybe something to do with the size of the dropdown? I'm a newbie to this so I dunno! hehe

Thanks

0
 
LVL 3

Expert Comment

by:red010knight
ID: 9702391
Well a quick search on google.com for 'javascript netscape vs ie' it comes up with these things:

which bascially mean you need to reference the field by getElementById('fieldIdName') rather than with the field name.

Stupid stuff that IE takes into account but netscape does that varies from the overly userfriendly methods of Microsoft

Red010Knight

0
 
LVL 2

Author Comment

by:bloodtrain
ID: 9703266
I'm sorry but I don't understand what you mean exactly.. :) I'm really crappy at javascript! hehe. do you think you can give me a code example?

Thanks
0
 
LVL 3

Expert Comment

by:red010knight
ID: 9706829
for example:

change
 common = win.qs_provState;
to
 common = win.getElementById('qs_provState');

that help?

Red010Knight
0
 
LVL 2

Author Comment

by:bloodtrain
ID: 9707646
I put that change in there but it made things worse. In NS, I couldn't even see that box anymore with the weird scrolling and in IE, an error said: Object doesn't support this property or method.
0
 
LVL 2

Author Comment

by:bloodtrain
ID: 9707664
Wow, the way I fixed it for now was to put 5 options :

<option value="">Search All</option>
<option value="">Search All</option>
<option value="">Search All</option>
<option value="">Search All</option>
<option value="">Search All</option>

This some how gives the box a height of 5 lines so now everything works. And these above boxes are not even visible because they are wiped clean from the array.  Very interesting.  So I guess I was on the right track earlier when I said that it has something to do with specifying the size of the dropdown..

Anyway - what do I know. heheh.
0
 
LVL 2

Author Comment

by:bloodtrain
ID: 11438119
DELETE THIS QUESTION
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 11908698
The question has been PAQ'd and the 50 points have been refunded.
RomMod
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 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