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 871901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:42:29+00:00 2026-05-15T10:42:29+00:00

<form method=post name=test id=test> <input type=hidden name=listname value=qpaustin /> <select name=customCity id=customCity onchange=javascript:onChangeHiddenValue(this.value);> <option

  • 0
<form method="post" name="test" id="test">
<input type="hidden" name="listname" value="qpaustin" />
<select name="customCity" id="customCity" onchange="javascript:onChangeHiddenValue(this.value);"> 
<option value="qpneworleans" >qpneworleans</option>
<option selected="selected" id="listSelectionActiveOption" value="qpnewyork" >qpnewyork</option>
<option value="qporangecounty">qporangecounty</option>
<option value="qporlando">qporlando</option>
</select>
</form>
<script type="text/javascript">
function onChangeHiddenValue(cityName)
{

    alert(document.getElementById('customCity').value);

}
</script>

I need to change the hidden value “listname” dynamically using javascript.

For example, currently the value of listname is qpaustin. But when i change the value to qpneworleans the “listname” value should be replaced to qpneworleans .

How to do this.

Kindly advice. Thanks in advance

  • 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-15T10:42:29+00:00Added an answer on May 15, 2026 at 10:42 am

    A few comments:

    1. The onchange event should be bound to the select element, no to the options.
    2. Give your form a name, that will make the programmatic access easier, e.g. document.forms['formName']

    For example:

    <form method="post" name="form1">
      <input type="hidden" name="listname" value="qpaustin" />
      <select name="customCity" onchange="onChangeHiddenValue(this.value);"> 
        <option value="qpneworleans">qpneworleans</option>
        <option selected="selected" value="qpnewyork">qpnewyork</option>
        <option value="qporangecounty">qporangecounty</option>
        <option value="qporlando" >qporlando</option>
      </select>
    </form>
    
    <script type="text/javascript">
    function onChangeHiddenValue(cityName) {
      // DOM2 standard way to access forms and elements
      document.forms['form1'].elements['listname'].value = cityName;
    }
    </script>
    

    Check the above example here.

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

Sidebar

Related Questions

<form action=test.php method=post> Name: <input type=text name=fname /> <input type=hidden name=fname value=test /> Age:
<form action = settings.php method = post> Student ID*: <input type = text name
HTML <form id=contact_form action=# name= method=POST> <label for=name>NAME</label> <input type=text name=name id=name class=contact_form_input />
form html: <form action='/register/' method = 'post'>{% csrf_token %} ... <label>Avatar: </label><input type='file' name='avatar'
Lets say that you have a following simple application: <form action=helloServlet method=post> Give name:<input
Consider the following Mechanize form object #<Mechanize::Form {name f1} {method POST} {action f.php} {fields
I have file with name contact.php, inside I have form: <form method=post name=kontakt action=send_mail.php>
Is something like this possible: <form method=post action=myphp.php name=myname target=another_html/iframe_name>??? I want the php
I created this form: <form method=post action=process-form.php id=emailForm name=emailForm target=_self> <h4>Sign up to be
I trying @RequestMapping(value = /test, method = RequestMethod.POST) but is error Code is @Controller

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.