Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross Browser Issue

Status
Not open for further replies.

casa3311

Programmer
Dec 10, 2002
12
US
I have a form which contains a button, which when clicked will allow the user to search a table. I is working in IE, but not in Netscape. What is supposed to happen is that the user has a choice between typing in search criteria in text box 1 or selecting a common search item from a drop down list in select box 2. Then they click on the "Find" button which takes them to a javascript which in turns takes them to a perl script which displays the search results, where they select the radio button of the item they want and that value in turn is put back into the text box 1. Then they proceed filling out the form and click submit at the bottom of the form. I have added alert boxes to my javascript and in Netscape, null values are returned where there should be a value. Here are the call and script:

<input type=&quot;button&quot; name=&quot;choice&quot; onClick=&quot;searchProgramIndvTr()&quot;; value=&quot;Find Course&quot;>

function searchProgramIndvTr() {
alert (&quot;function searchProgramIndvTr&quot;);
if (document.IndvTr.Special.selectedIndex == 0) {
alert (&quot;if Special is &quot;+document.IndvTr.Special.value);
if (document.IndvTr.Program.value.length == 0 || document.IndvTr.Program.value == &quot;+&quot;) {
alert (&quot;if Program is &quot;+document.IndvTr.Program.value);
document.IndvTr.Program.value = &quot;+&quot;;
x=window.confirm (&quot;Leaving the Program Field blank\nwill return the complete Catalog Listing.\n\nThis listing may take a few minutes to load.\n\nClick OK to Continue&quot;);
if (!x) {//
document.IndvTr.Program.focus();
return false;
}//
} else {
alert (&quot;else Program is &quot;+document.IndvTr.Program.value);
var criteria=document.IndvTr.Program.value;
alert (&quot;Program criteria is &quot;+criteria);
}
} else {
alert (&quot;else Special is &quot;+document.IndvTr.Special.value);
var criteria=document.IndvTr.Special.value;
alert (&quot;criteria is &quot;+criteria);
}
 
sorry, it's behind a firewall. Let me think about it for a bit and see if I can more it somewhere that you can look at it.
 
We've closed in on the problem. I added a bunch of alert boxes and what I find is that when the user selects from the <select name=&quot;selectfield&quot;> box, in NS, the value (document.formname.selectfield.value) is null, but in IE, it contains the correct value. In both NS and IE, the selectedindex for that field is correct. I have had several people look at the code and no one sees any obvious errors. All aspects of the script work EXCEPT this one. If the user enters a + or leaves the field in textbox 1 blank, the program retrieves all records. If they enter a search critera, say &quot;programming&quot; the program retrieves all records that contain the word &quot;Programming&quot;. It's just that one select field that won't retrieve the proper value in NS. It would be really complicated and time consuming to strip out that part of the code and put it on another server because I have to move 3 perl scripts and a bunch a data file.
 
Found it!

document.IndvTr.Special.options[document.IndvTr.Special.selectedIndex].value

Thanks for looking at this!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top