I have been trying to get the string value of populated data to submit with my form and have hit a road block. Any help would be appreciated.
This is what I have so far…:
<html> <head>
<script language=”Javascript”>
var arrayData = new Array();
arrayData[0] = ‘bike1 $25.00|<input type=”hidden” name=”amount” value=”25.00″>|’
arrayData[1] = ‘bike2 $40.00|<input type=”hidden” name=”amount” value=”40.00″>|’
arrayData[2] = ‘bike3 $45.00|<input type=”hidden” name=”amount” value=”45.00″>|’
function populateData( name ) {
select = window.document.form1.SubCategory;
string = “”;
count = 0;
select.options.length = count;
for( i = 0; i < arrayData.length; i++ ) {
string = arrayData[i].split( “|” );
if( string[0] == name ) {
select.options[count++] = new Option( string[1] );
} }
// select.options.selectedIndex = 2;
// select.focus();
}
</script></HEAD>
<body>
<form target=”” action=”” method=”post”>
<input type=”image” src=”img/bt0_0.gif” border=”0″ name=”submit”>
<input type=”hidden” name=”add” value=”1″>
<!–additional hidden inputs–>
</form><!–this tag needs to go in order for form1 to be submited along with the form above–>
<form name=”form1″ target=”” action=”” method=”post”>
<input type=”hidden” name=”on0″ value=”Select Size”>
<select name=’os0′ style=”width:120;” onChange=’populateData( this.options[selectedIndex].text )’>
<option value=””>Select Model</option>
<option value=”bike1″>bike1 $20.00</option><!–selected option value must be submited with form1–>
<option value=”bike2″>bike2 $40.00</option>
<option value=”bike3″>bike3 $45.00</option>
</select>
<select name=”SubCategory”></select> <!–SubCategory string value must be submited with form1
as a hidden value–>
</form>
</BODY>
</HTML>