/    Sign up×
Community /Pin to ProfileBookmark

Passing JS variables to hidden fields

Hi,

I have two frames. The top frame extracts input values from the bottom frame and submits it to a form handler.

My problem is that I can’t get the values from the bottom frame into hidden fields to be submitted. My code is below:

Thanks for the help. Greatly appreciated!

Frameset
————

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
</head>
<frameset rows=”50,*” frameborder=”NO” border=”0″ framespacing=”0″>
<frame src=”LetterTop.cfm” name=”TopFrame” scrolling=”NO” noresize >
<frame src=”LetterBody.cfm” name=”BodyFrame”>
</frameset>
<noframes><body>

</body></noframes>
</html>

BodyFrame
——————

<FORM NAME=”formtwo”>
Enter some text: <INPUT TYPE=”text” NAME=”test1″><br>
Enter some text: <INPUT TYPE=”text” NAME=”test2″>
<P><INPUT TYPE=”BUTTON” VALUE=”Submit”>
</FORM>

TopFrame
————-

<SCRIPT LANGUAGE=”JavaScript”>
<!–

function store_info(){
var document.formone.hide1.value=top.frames[1].formtwo.test1.value;
var document.formone.hide1.value=top.frames[1].formtwo.test2.value;
document.formone.submit();

//–>
}
</SCRIPT>

<FORM NAME=”formone” action=”test.cfm”>
Enter some text: <INPUT TYPE=”text” NAME=”test3″>
<INPUT TYPE=”HIDDEN” NAME=”hide1″>
<INPUT TYPE=”HIDDEN” NAME=”hide2″>
<P>
<INPUT TYPE=”BUTTON” VALUE=”Submit” onClick=”store_info()”>

</FORM>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @blue44 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...