Welcome to WebmasterWorld Guest from 54.146.239.96

Forum Moderators: open

Message Too Old, No Replies

Form Variables With Javascript

Help

     

mbennie

7:40 am on Apr 13, 2003 (gmt 0)

10+ Year Member



If I have 2 forms on a page, and form 2 needs some of the input from form 1, what is the best way to transfer the variables to the second form? Javascript?

Any code samples would be greatly appreciated.

ShawnR

11:24 am on Apr 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have a look at [javascript.internet.com...]

Shawn

Birdman

11:29 am on Apr 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use an event handler to call a function that writes to the second form.

Like:
<form name="form1">
<input type="text" name="field1" onBlur="form2(field1)" />

In the head:
function form2(thefield){
if(thefield == field1){
document.form2.field1.write(document.form1.field1.value)
}
}

Something like that, my JS skills are rusty.