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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:07:25+00:00 2026-05-18T10:07:25+00:00

I have a simple form with four select fields. If YES is selected on

  • 0

I have a simple form with four select fields. If YES is selected on any form field, the submit button needs to be disabled and a hidden div should appear. Here’s an example of my markup:

<form>
I have read the information on the product(s)<select name="field4"> <option value="Yes">Yes</option> <option value="No">No</option> </select>

Do you have any allergies to any ingredients in product(s)?
 <select name="field5"><option value="Yes">Yes</option> <option value="No">No</option> </select>

Are you pregnant?
 <select name="field6"> <option value="Yes">Yes</option> <option value="No">No</option> </select>

Have you ever used this type of product and had undesirable results?
 <select name="field7"> <option value="Yes">Yes</option> <option value="No">No</option> </select>

<input name="cmdSubmit" type="submit" value="Submit" />
</form>


<div style="display:none;">Hidden div only to appear if any of the four dropdowns are marked YES.</div>

Thanks for your help on this one. I am a jquery novice trying my best to learn.

  • 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-18T10:07:25+00:00Added an answer on May 18, 2026 at 10:07 am

    I don’t completely understand the business logic of the way you have the form built and your requirements but… going based on what you have said here is what I would do.

    1. write function to check all options, change disable/enable submit, show/hide div
    2. call function on load
    3. call function to check all options every time an option value changes

    .

    checkOptions();
    $("select").change(checkOptions);
    
    function checkOptions() {
      var yesFound = false;
      $("select").each(function(index, element) {
        if ( $(element).val() == "Yes" ) {
          yesFound = true;
        }
      });
    
      if (yesFound) {
        $("#hidden-div").show();
        $("input[type=Submit]").attr("disabled","disabled");
      } else {
        $("#hidden-div").hide();
        $("input[type=Submit]").removeAttr("disabled");
      };
    }
    

    with slightly modified HTML:

    <form>
      <select name="field4"> 
        <option value="Yes">Yes</option>
        <option value="No">No</option>
      </select> I have read the information on the product(s)<br/>
      <select name="field5">
        <option value="Yes">Yes</option>
        <option value="No">No</option>
      </select> Do you have any allergies to any ingredients in product(s)?<br/>
      <select name="field6">
        <option value="Yes">Yes</option>
        <option value="No">No</option>
      </select> Are you pregnant?<br/>
      <select name="field7">
        <option value="Yes">Yes</option>
        <option value="No">No</option>
      </select> Have you ever used this type of product and had undesirable results?<br/>
      <br/>
      <input name="cmdSubmit" type="submit" value="Submit" />
    </form>
    <div id="hidden-div" style="display:none;">Hidden div only to appear if any of the four dropdowns are marked YES.</div>
    

    Example webpage:

    http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-disable-submit-dynamically.html

    On load:

    alt text

    all options ‘No’ but one:

    alt text

    all options ‘Yes’:

    alt text

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

Sidebar

Related Questions

I have a simple form on a view page, implemented as a user control,
I have a simple form with some plain html input like bellow using ASP.NET
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I'm making my first foray into WPF - I have a simple form with
We have a simple registration form for our website users where we only require
I have a relatively simple form which asks a variety of questions. One of
There are some HTML based games (ie bootleggers.us) that have a simple login form
Ok, so I have a very simple form with next to no logic in
I am using .NET2.0. Let's say a have a simple aspx form with txtInput
I have a really simple search form with the following Label (Search) Textbox (fixed

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.