DogPooOnYourShoe
DogPooOnYourShoe

Reputation: 149

Duplicating value from one form to another

Say, I have got a form which uses the same values as my other form but the first form contains data which I would like to have on my second form. Such as something from a drop-down list box. I am still a noob at HTML and dont know how to do this. Any assistance is gratefully appreciated!

Upvotes: 0

Views: 1788

Answers (2)

sdleihssirhc
sdleihssirhc

Reputation: 42496

You could do something like this:

var form1,
i = 1;
while (form1 = document.getElementById("form1_input" + i)) {
    document.getElementById("form2_input" + i).value = form1.value;
    i += 1;
}

Upvotes: 0

pythonFoo
pythonFoo

Reputation: 2194

With javascript:

<form>
   <input type="text" name="textBox" id="textBox" onchange="document.getElementById('textBox2').value = document.getElementById('textBox').value;">
</form>

<form>
   <input type="text" name="textBox2" id="textBox2">
</form>

You can do this for any field.

Upvotes: 1

Related Questions