tarnfeld tarnfeld - 1 year ago 127
HTML Question

Two forms share same input

How can two forms share the same inputs?
I have two forms, one for two different paths... if i wanted to get the user to enter their name, but only once.... how could both forms get hold on this field?

Answer Source

Using JavaScript you could set one field's value to another's.

Something like:

document.form2.input.value = this.value;

Put that code in the onblur event for your first form.


<form name="form1">
<input type="text" name="input" onblur="document.form2.input.value = this.value;" />

<form name="form2">
<input type="text" name="input" onblur="document.form1.input.value = this.value;" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download