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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progressive form not populating

Status
Not open for further replies.

froghog

IS-IT--Management
Joined
Aug 16, 2006
Messages
2
Location
US
I have a form with two "select" fields. Select an item in the first field and it should populate the second field. However the second field is not populating. Why isan't the second form field populating? The script worked before I tried to merge it with my form.

Any help you could provide would be greatly appreciated.

Code:
Code:
<html>
<head>
<script language="Javascript"> 
 
var arrayData = new Array(); 
 
arrayData[0]    = 'NOVAMETRIX MEDICAL SYSTEMS|5001 Pulse Oximeter|' 
arrayData[1]    = 'NOVAMETRIX MEDICAL SYSTEMS|500, 500A Pulse Oximeter Battery|' 
arrayData[2]    = 'NOVAMETRIX MEDICAL SYSTEMS|505, 515, 515A, 520A Memory Back-Up|' 
arrayData[3]    = 'General Electric|AMXIV-Complete Set of Nine Battery|' 
arrayData[4]    = 'General Electric|Maxi II Gamma Camera Battery|' 
arrayData[5]    = 'General Electric|Portable X-Ray CMX, AMXI, AMXII, AMXIII, AMX110 Battery|' 
arrayData[6]    = 'OXFORD MEDICAL|M-3 Monitor Battery|' 
arrayData[7]    = 'OXFORD MEDICAL|Meda-Log 4000-3 Battery|' 
arrayData[8]    = 'OXFORD MEDICAL|MR-95 Ambulatory EEG Monitor Battery|' 
 
 
function populateData( name ) { 
 
    select    = window.document.form.keyword2; 
    string    = ""; 
 
        // 0 - will display the new options only 
        // 1 - will display the first existing option plus the new options 
 
    count    = 0; 
 
        // Clear the old list (above element 0) 
 
    select.options.length = count; 
 
        // Place all matching keyword1 into Options. 
 
    for( i = 0; i < arrayData.length; i++ ) { 
        string = arrayData[i].split( "|" ); 
        if( string[0] == name ) { 
            select.options[count++] = new Option( string[1] ); 
        } 
    } 
 
        // Set which option from keyword2 is to be selected 
 
//    select.options.selectedIndex = 2; 
 
        // Give keyword2 focus and select it 
 
//    select.focus(); 
 
} 
 
</script>
</head>

<br/>

	<form action="[URL unfurl="true"]http://jasoncoulthard.com/joomla/index.php"[/URL] method="post" name="adv_search">
	<input type="hidden" name="page" value="shop.browse" />
	<input type="hidden" name="option" value="com_virtuemart" />
	<input type="hidden" name="Itemid" value="1" />
  
       <select name='keyword1' onChange='populateData( this.options[this.selectedIndex].text )' value="keyword1">
	<option>Select a Manufacturer</option> 
        <option>NOVAMETRIX MEDICAL SYSTEMS</option> 
        <option>General Electric</option> 
	<option>OXFORD MEDICAL</option>
</select>
            <br /><br />
            <input type="hidden" name="search_op" value="and" />
               
            <select name='keyword2' style="width:250;" value="keyword2" >
</select>
            <br /><br />
            <select class="inputbox" name="search_category">
         <option value="0">Search All Categories</option>
         <option value="1">Laser Systems</option>
         <option value="4">Medical Batteries</option>
         <option value="3">Medical Lamps</option>
         <option value="2">Safety Goggles</option>
                  </select>
            <br /><br />
            <input type="hidden" value="desc" name="search_limiter" />
            <input type="submit" class="button" name="search" value="Search">
            <br />
	</form>
      </html>
 
change
Code:
select    = window.document.form.keyword2;
to
Code:
select    = window.document.adv_search.keyword2;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top