Copy email address from one input form to another—different pages

77 views Asked by At

I am making a website with a place to type in an email address to sign up for a mailing list. Once GO has been pressed, another page shows up with another email input and another GO button.

Is it possible to somehow grab the first email address after it's been typed and automatically place it into the second page's email box?

My code for the first email box:

<div id="email">
<form action="http://widget-platform.fanbridge.com/widget/render/12676" target="blank" method="post">
            <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                    <td colspan="1"><div align="left">

                    </div></td>

                        <td valign="top"><div align="right"></div></td>
                        <td valign="top"><input name="email" type="text" id="email"></td>


                    <td > 
                        <div class="img"><input type="image" img src="img/go.png" /></td></span>
                        </div>

                    </tr>
                </table>
            </form>                  

      </div>
1

There are 1 answers

0
fuesika On

You basically need a JavaScript-function that retrieves the value from the first input-box and copies it to the second:

<script language="JavaScript">
function copyMail(f) {
    f.secondInputMail.value = f.firstInputMail.value;
}
</script>

The submit-"button" then needs to be added an attribute onClick to call this function:

<input type="image" img src="img/go.png" onClick="copyMail(this.form);" />

It jas been a while since I used JavaScript, but you should get an idea from this.