Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6667667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:57:27+00:00 2026-05-26T02:57:27+00:00

I have a page with multiple forms, however all forms need to take the

  • 0

I have a page with multiple forms, however all forms need to take the value of a radio button in the products form. Below is a simplified version of my forms which are all on the same page.

<form name="products" method="post" action="" />
<input id="prod_name" name="prod_name" type="radio" value="Product 1" checked />
<input id="prod_name" name="prod_name" type="radio" value="Product 2" />
</form>

<form name="delivery_method1" method="post" action="" />
<input type="hidden" id="item_name" name="item_name" value=""/>
<input type="image" name="submit" value="submit">
</form>

<form name="delivery_method2" method="post" action="" />
<input type="hidden" id="item_name" name="item_name" value=""/>
<input type="image" name="submit" value="submit">
</form>

I understand I should be able to copy the value of “prod_name” into the hidden field of “item_name” using JavaScript however I have tried a number of solutions but they haven’t worked.

I have very little JavaScript knowledge so I would appreciate if someone could provide me with a full function and details of how the function is actioned from within the form.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:57:28+00:00Added an answer on May 26, 2026 at 2:57 am

    ID attributes should be unique. If you don’t need them, remove these. If you’re using id=... for styling purposes, replace all occurences of id= by class=, and replace the sharp (#) in the CSS by a dot.

    When a form is submitted, only elements with a name attribute are sent.
    This should work:

    ....
    <script>
    function fill(value) {
        var forms = document.forms;
        for (var i = 0; i < forms.length; i++) {
            if (forms[i].item_name) forms[i].item_name.value = value;
        }
    }
    </script>
    </head>
    <body>
    ...
    <form name="products" method="post" action="">
    <input onchange="fill(this.value)" name="prod_name" type="radio" value="Product 1" checked />
    <input onchange="fill(this.value)" name="prod_name" type="radio" value="Product 2" />
    </form>
    ...
    

    All form elements are accessible through their name at the form element. All forms are accessible (by name or by their index in the document) through the document.forms object.

    When the radio selection changes, function fill() is called, passing this.value as an argument. From the context of the radio input elements, this.value points to the value of the radio element.

    Then, we loop through all forms in the document. If item_name is an element in the form, the value is updated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with multiple forms that I submit via Ajax POSTs serially.
I have multiple forms on a page, for each of them I want the
I have a form on an HTML page with multiple submit buttons that perform
I have an aspx page with multiple FileUpload controls and one Upload button. In
I have a form I need to use on multiple pages: Controller $emailForm =
I have some code as such to submit multiple forms on my page at
I have to fill in multiple form fields on a web page I got
I have a page with multiple forms (2 forms) on that page. There is
I have a template page expecting two forms. If I just use one form,
I have a page where multiple forms are submitted to different 3rd party sites...I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.