Trying to set the value of one form to be the same as the other


I am trying to set the value of form with name:

to be equal to that of:

But although everything seems to be firing OK, the value of 2 is not changing to that of 1.
Here are the related codes;

function set_equal ($f, $ix)

var url_a = ‘url2ix_’ + $ix;
var url_b = ‘url2ix_’ + ($ix + 1);

alert('b = ’ + url_b);

f.url_b.value = f.url_a.value;


being called by:

<input type=“button” name=“copy” Value=“Copy” OnClick=“set_equal(this.form, <?php echo $i; ?>)” class=“form_button”>

what is the problem?


Where do you define f ?

Use the error console.

I wrote a short blog post on how to do this. Maybe that helps.

Hi WorldNews,

Just check that before the value is getting assign, is there any error the above code or just try by calling the same function and only assign the field value in the function i.e

function set_equal ($f, $ix)

f.url2ix_2.value = f.url2ix_1.value;


just check if this works…


Just wanted to let you know that resolved this with:

function set_equal ($ix)

var url_s = 'ix_' + $ix;
var url_e = 'ix_' + ($ix + 1);

document.getElementById(url_e).value = document.getElementById(url_s).value;