I am trying to pass the values of input fields on one html page to another html page that has a form with input fields. How do I write the dojo or JavaScript code to accomplish this?
<form id="form1" method="post" action="form2.html">
First Name: <input id="tFName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" />
<br/>
<br/>
Last Name: <input id="tLName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" />
<br/>
<input type='submit' value='Submit'/>
</form>
here is form 2:
<form id="form">
First Name: <input id="tFName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" />
<br/>
<br/>
Last Name: <input id="tLName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" />
<br/>
<input type='submit' value='Save Your Name'/>
</form>
You can’t simply send data from one
.htmlpage to another, with or without javascript.A form
POSTcauses the browser to send the form data to the server in the body of theHTTPrequest. You must then run some code on the server to do something with that data, even if it’s just setting it as the initial values of fields on a different .html page.