Solved

Dependent Drop-Down: Netscape Problem

Posted on 2003-11-07
11
231 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now