/    Sign up×
Community /Pin to ProfileBookmark

How to submit populated data with form???

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>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @hdmort 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,
)...