Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Updating fields in one form from another

    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)
    Last edited by gazsux; 01-10-2004 at 07:53 PM.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •