...

View Full Version : Updating fields in one form from another



gazsux
01-10-2004, 07:46 PM
Hello,

I want to know how I can update a field in another form.

For example. If I have a webpage with two forms on it. I have a name field on form1. When I submit form1 I want it to process that form but also update a textarea in form2 with the content of the name field from form1.

I know if I wanted to use a drop down box to update a field in the same form I can do something like:

<select name="common" onchange="this.form.headline.value=this.form.common.options[this.form.common.selectedIndex].value;this.form.common.selectedIndex=0">

...

</select>

Is it similar if I want to update a field in another form on the same page?

I hope I have explained it clearly, any help is appreciated.

Thank you

(Note: this duplicates a thread in 'other server side scripting' section - I mistakenly posted it there as I didn't see this section - I'm not trying to spam my query over multiple areas)

Garadon
01-10-2004, 07:53 PM
replace
FORMNAME with the name of the 2nd form
INPUTFIELDNAME with the name of the inputfield u wanna change.

put this in the onclick for the submit button.
document.FORMNAME.INPUTFIELDNAME.value="something";


just one thing though it seems to me that this is weird thing to do since it will reload the page when u submit it, if I recall correct that is :)

gazsux
01-10-2004, 08:10 PM
:thumbsup: Thank you, it works :)

I am using target="" to submit form1 to a given frame and updating the field in form2. This avoids the refresh problem you brought up.

Thanks for your help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum