...

View Full Version : How to send one form field to another page



mr_michael
12-23-2011, 09:55 PM
Hello,

First off thank you for looking at my post. Please forgive me if I do something incorrectly here. I have never posted in a forum before.
You are very kind to assist me in this problem.

I wish to send the javascript calculated value in a form from one page to another page form. I just need the one value sent. The value is "answer: in the code below. I would like to send it to a form page called "answer.html"

I am not a computer person, and I am doing this in frontpage. I do not know how to write java or anything, I just copied this from a free script site and am trying to use it.

Thank you once again for your kindness and patience with me. Thanks to all you experts!

Michael

here is the code I have.
---------------------------------------------


<table cellspacing=0 width=427
height=1 bgcolor="#FFFFFF" style="border-collapse: collapse" cellpadding="0" border="0">
<tr>
<td width="634" nowrap height="1">

<script language="JavaScript">
function findcalculatorcalculate(form) {
a = form.debt.value - 0;
b = form.faith.value - 0;
d = a / b;
form.answer.value = Math.round (d);
}</script>


<p align="right" style="margin-left: 3; margin-right: 5"></p>
<form name="form" style=" margin-right: 5; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" action="--WEBBOT-SELF--" method="POST">
<p align="right">
<font style="font-size: 11pt; font-weight:700">Input amount <input class="regfont" size="13" type="text" name="debt"></font><span style="font-size: 11pt; font-weight:700"> <br>
divide by
</span><font style="font-size: 11pt; font-weight:700"><input class="regfont" size="6" type="text" name="faith"></font><br>
<b><font color="#FF0000" size="5">&nbsp;</font></b><font style="font-size: 11pt"><input onclick="findcalculatorcalculate(this.form)" value="CLICK HERE TO CALCULATE" type="button" style="border-style:solid; border-width:2; font-weight: bold; font-family:Arial"><br>
<b>ANSWER</b>
</font></font>
<INPUT NAME="answer" SIZE="5" VALUE=""><br>
<INPUT TYPE="BUTTON" onClick="nextpage()" VALUE="Go to the next page"></p>
</p>
</form>
</td>
</tr>
</table>
<p align="right" style="margin-left: 3; margin-right: 5">I would like ANSWER
field to
pre populate the calculated amount on the second page titled &quot;answer.html&quot; THANK
YOU!</p>


------------------------
Thank you again for helping me in plain language because I do not have the skills that all of you do.

xelawho
12-23-2011, 10:21 PM
hello. You can add this:


function nextpage() {
window.open('answer.html?'+form.answer.value);
}


to the javascript on your first page

and then use this:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<form name="myForm">
<input type="text" name ="answer"/>
</form>
<script type="text/javascript">
var num = self.location.search.slice(1);
document.myForm.answer.value=num;
</script>
</body>
</html>

as the base to make your answer.html page. As long as they are saved into the same directory it should work :thumbsup:

mr_michael
12-23-2011, 11:32 PM
hello and thank you very much for your help

I am not sure where to put this javascript in the first page

<INPUT TYPE="BUTTON" onClick="nextpage()" VALUE="Go to the next page"></p>

where would this go?

function nextpage() {
window.open('answer.html?'+form.answer.value);
}

pardon, I have zero java knowledge

VIPStephan
12-23-2011, 11:39 PM
mr_michael, please write your code in between
tags, that makes it easier to distinguish it from regular text. You can use the small ‘#’ button in the reply window.

mr_michael
12-24-2011, 12:01 AM
hello and thank you very much for your help
I am sorry, I do not understand, forgive me I have no idea what to do.

Could you copy and paste an example please using the code I have, it must seem simple to you, but I have spent 6 hours trying to figure it out.

-----------
I am not sure where to put this javascript in the first page

<INPUT TYPE="BUTTON" onClick="nextpage()" VALUE="Go to the next page"></p>

where would this go?

function nextpage() {
window.open('answer.html?'+form.answer.value);
}

xelawho
12-24-2011, 12:02 AM
everything that you have between

<script language="JavaScript">
(which should be <script type="text/javascript"> by the way)

and


</script>

is javascript

so the nextpage() function can go anywhere between those two tags. Try putting it right before the </script>

this bit:

<INPUT TYPE="BUTTON" onClick="nextpage()" VALUE="Go to the next page"></p>

is HTML - it can stay where it is



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum