Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How to send one form field to another page

    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.
    ---------------------------------------------

    Code:
    <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.
    Last edited by VIPStephan; 12-23-2011 at 11:38 PM. Reason: wrapped code BB tags

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,899
    Thanks
    56
    Thanked 542 Times in 539 Posts
    hello. You can add this:
    Code:
    function nextpage() {
    window.open('answer.html?'+form.answer.value);
    }
    to the javascript on your first page

    and then use this:

    Code:
    <!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

  • Users who have thanked xelawho for this post:

    mr_michael (12-23-2011)

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,620
    Thanks
    6
    Thanked 1,001 Times in 974 Posts
    mr_michael, please write your code in between [CODE][/CODE] tags, that makes it easier to distinguish it from regular text. You can use the small ‘#’ button in the reply window.

  • Users who have thanked VIPStephan for this post:

    mr_michael (12-24-2011)

  • #5
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts


    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);
    }

  • #6
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,899
    Thanks
    56
    Thanked 542 Times in 539 Posts
    everything that you have between
    Code:
    <script language="JavaScript">
    (which should be <script type="text/javascript"> by the way)

    and

    Code:
    </script>
    is javascript

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

    this bit:
    Code:
    <INPUT TYPE="BUTTON" onClick="nextpage()" VALUE="Go to the next page"></p>
    is HTML - it can stay where it is


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •