Page 1 of 1
little problem in javascript
Posted: Thu Apr 05, 2007 2:43 am
by eshban
There is a little problem.
I have TWO HTML forms, there are two fields on both forms.
When i press the SUBMIT button of first form then i want that fields of Second form will be filled with that data (which i typed in form1). I dont want to refresh the second form to see the result. Thats why i want to use javascript.
How can i implement this. please help in this regard.
Thanks
Posted: Thu Apr 05, 2007 5:11 am
by thiscatis
I'm not quite sure what you mean,
Is it something like, filling in a delivery address, thicking a box "billing address is the same", and that all fields of the first address are also copied to the billing address fields?
Posted: Thu Apr 05, 2007 5:20 am
by eshban
no, you take the wrong meaning
I want when user fills the first form fields and press the submit button, then after submission the fields of form2 will be automatically filled with the data which i inserting in form1
Posted: Thu Apr 05, 2007 7:51 am
by abeterosso
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
...try this code:
[syntax="html"]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, http://www.pspad.com">
<title></title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
function Invio()
{
document.Form2.textBox3.value = document.Form1.textBox1.value;
document.Form2.textBox4.value = document.Form1.textBox2.value;
}
</SCRIPT>
<FORM NAME=Form1>
<P>Enter new text:
<INPUT TYPE="text"
NAME="textBox1">
<INPUT TYPE="text"
NAME="textBox2">
<INPUT TYPE="button"
VALUE="Submit"
onClick="Invio();">
</FORM>
<FORM NAME=Form2>
<P>Text from Form1:
<INPUT TYPE="text"
NAME="textBox3" VALUE="">
<INPUT TYPE="text"
NAME="textBox4" VALUE="">
</FORM>
</body>
</html>
feyd | Please use[/syntax]Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]