little problem in javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

little problem in javascript

Post 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
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post 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?
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

Post 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
User avatar
abeterosso
Forum Newbie
Posts: 11
Joined: Fri Mar 16, 2007 8:50 am
Location: Italy

Post by abeterosso »

feyd | Please use

Code: Select all

,

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

,

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]
Post Reply