View Full Version : Javascript not submitting information

Jan 9th, 2007, 09:43 PM
I am using a script provided to me by vwphillip on this forum. It functions great, but when the form is submitted the fields that rely on the script are not transmitted. I am using FrontPage for my forms and would like to continue, if possible. The fields "Option1" & "Option2" are the fields that aren't being submitted correctly. If I don't select these options then EMPTY is submitted, correctly. If I select a value such as Topic1, then the form is submitted with the answer blank.

Any help is greatly appreciated!



<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 15</title>
<script language="JavaScript" type="text/javascript">
var Ary1=[];
Ary1[1]=['Topic 1','Topic 2'];
Ary1[2]=['Topic 3','Topic 4'];

function Populate(obj,ary,sela,selb){
var args=Populate.arguments;
var index=args[0].selectedIndex;
if (index<1){ return; }
var sel1=document.getElementById(args[2]);
var sel2=document.getElementById(args[3]);
sel1.options[0]=new Option('Select','',true,true);
sel2.options[0]=new Option('Select','',true,true);
for (var zxc1=0;zxc1<args[1][index].length;zxc1++){
sel1.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);
sel2.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);

<form method="POST" name="test" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Email-Format="TEXT/PRE" S-Email-Address="[email protected]" B-Email-Label-Fields="TRUE" S-Builtin-Fields -->
<select onclick="Populate(this,Ary1,'sel1','sel2');" >
<option >Select</option>
<option >List 1</option>
<option >List 2</option>
<select id='sel1' name="Option1" size="1">
<option >EMPTY</option>
<select id='sel2' name="Option2" size="1">
<option >EMPTY</option>
<input type="submit" value="Submit" name="B1"></form>


Jan 9th, 2007, 09:51 PM
sel1.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);
sel2.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);

I believe that will return an empty string as your value ''.

new Option( text [, value [, defaultSelected [, selected ]]] );

sel1.options[zxc1+1]=new Option(ary[index][zxc1],ary[index][zxc1],true,true);
sel2.options[zxc1+1]=new Option(ary[index][zxc1],ary[index][zxc1],true,true);

Jan 9th, 2007, 10:06 PM
Thank you SpirtOfGrandeur!!!

That worked perfectly. I appreciate your help!