/    Sign up×
Community /Pin to ProfileBookmark

Script not submitting info with form

I am using a script provided to me by a coding guru(vmphillips). 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!

Jeremy

[CODE]<html>

<head>
<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);
}
sel1.selectedIndex=0;
sel2.selectedIndex=0;
}
//–>
</script>
</head>

<body>
<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>
<select id=’sel1′ name=”Option1″ size=”1″>
<option >EMPTY</option>
</select>
<select id=’sel2′ name=”Option2″ size=”1″>
<option >EMPTY</option>
</select>
<input type=”submit” value=”Submit” name=”B1″></form>
</body>

</html>[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mjdamatoJan 09.2007 — Simple fix. The problem is with these two lines (from your coding guru):

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


The 1st parameter for new Option is the "text" that you want displayed in the select field. The 2nd parameter (which is an empty string in your code) is the VALUE for the select option.

Change those two lines to this and all should be fine:

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);
Copy linkTweet thisAlerts:
@DdYrSstrauthorJan 09.2007 — That worked perfectly. I appreciate your help.

Thank you!

Jeremy
×

Success!

Help @DdYrSstr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...