Solved

Dependent Drop-Down: Netscape Problem

Posted on 2003-11-07
11
233 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
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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

831 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