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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:56:15+00:00 2026-05-31T12:56:15+00:00

I have a form with a varying number of dropdown boxes rendered with HTML.

  • 0

I have a form with a varying number of dropdown boxes rendered with HTML. I wish to pass to the user a value from one of these dropdown boxes – just one value. How can I do this? It’s such a simple thing but I have spent hours on it.

<form id="form" name="form" method="post" action="nextStep.cshtml">
   <select name="1">
      <option value="1">1</option>
      <option value="2">2</option>
   </select>

   <select name="2">
      <option value="3">3</option>
      <option value="4">4</option>
   </select>

   <button type="submit">Submit</button>

And in nextStep.cshtml I have :

var number = Request.form[//what can I do here?];

The dropdowns names are populated in a loop. The functionality I wish to have is for the user to select a value from one dropdown, and all others to be disabled. I then want to be able to extract just this piece of data in nextStep.cshtml.

How can I do this?

Error is in this code :

<script>
$(function(){
   $('#form select').change(function(){
      var thisDd = $(this);
      $('#myValueField').val(thisDd.val());
      $('#form select').each(function(i, e){
          if(thisDd.val() == ""){
            $(e).attr('enabled', 'enabled');
          } else{ 
          if(e==thisDd[0]) return; // not disable myself
          $(e).attr('disabled', 'disabled'); // disable other
        }
      });
   });
});
</script>
  • 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-31T12:56:16+00:00Added an answer on May 31, 2026 at 12:56 pm

    Using jQuery you can do this (not tested):

    <hidden name="myValueField" id="myValueField">
    
    // Submit the form after selection
    $(function(){
       $('#form select').change(function(){
          $('#myValueField').val($(this).val());
          $('#form').submit();
       });
    });
    
    // or disable other dropdowns after selection
    $(function(){
       $('#form select').change(function(){
          var thisDd = $(this);
          $('#myValueField').val(thisDd.val());
          $('#form select').each(function(i, e){
              if(e==thisDd[0]) return; // not disable myself
              $(e).attr('disabled', 'disabled'); // disable other
          });
       });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form with user defined filters ( combobox with column names, combobox with
I have form with one input for email and two submit buttons to subscribe
I have form where user submits field. Field can have letters, numbers, and punctuation.
I currently have form that checks if a user has unsubmitted changes when they
I have form with checkboxes loaded from database (I use entity field type). Checkboxes
I have form with some objects. In case of a dropdown box, when the
We have an MDI form which contains some number of child forms which have
I have a form that has an array of dynamically created labels of varying
I have an HTML form with sections laid out like this: I do want
I'm building a form application in c#. I have between 6-12 different comboboxes (varying

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.