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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:04:06+00:00 2026-06-16T07:04:06+00:00

I have been working with a form in which I want the submit button

  • 0

I have been working with a form in which I want the submit button to be disabled unless a textarea and a select option is chosen.

The textarea verifications works fine, the problem is with the select.
The thing is that the select takes its value from a Custom drowpdown that pases the value to the select and I think that is the problem, as the script doesn’t take it as the select has a value.

The script works if:
a) You first pick a select option and then type in the textarea.
b) You type in the textarea, select an option and then type again in the textarea.

The script for the enable/disable button is this

    $(function () {
        $("#result, #content-text-ta").bind("keyup change",
  function () {      
      if ($("#content-text-ta").val() != "" && $("#result").val() != "")
          $(this).closest("form").find(":submit").removeAttr("disabled").removeClass('disabled').addClass('enabled');
      else
          $(this).closest("form").find(":submit").attr("disabled", "disabled").removeClass('enabled').addClass('disabled');      
      });
        });

The textarea and dropdown that pases the value to the select (id=”catselect”)

<textarea title="Post Text" name="content-text-ta" id="content-text-ta"></textarea>
<dl id="sample" class="dropdown">
                    <dt><a href="#" ><span class="cat" tabindex="1">Elige categoria</span></a></dt>
                        <dd style="z-index: 1;">
                            <ul>
                                <li><a href="#">Citas Famosas<span class="value">1</span></a></li>
                                <li><a href="#">Frases Bonitas<span class="value">2</span></a></li>
                            </ul>
                        </dd>
                    </dl>
                    <fieldset">
                        <select name='categories' id='catselect' class='tdomf_categories' size='1'>
                            <option id="result"></option>
                        </select>
                    </fieldset>
  • 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-06-16T07:04:07+00:00Added an answer on June 16, 2026 at 7:04 am

    Use the following code:

    function validateForm() {
        if ($("#content-text-ta").val() !== "" && $("#catselect").val().length > 0) {
            $("form").find("input[type*='submit']").removeAttr("disabled").removeClass('disabled').addClass('enabled');
        } else {
            $("form").find("input[type*='submit']").attr("disabled", "disabled").removeClass('enabled').addClass('disabled');
        }
    }
    $(function() {
        $("#catselect").html("");
        $(".dropdown dd ul li a").click(function() {
            var text = $(this).html();
            $(".dropdown dt a span").html(text);
            $(".dropdown dd ul").hide();
            $("#catselect").val($("#sample").find("dt a span.value").html());
            validateForm();
        });
        $("#catselect").append($("<option/>", {
            value: "",
            text: $(this).find('span').first().contents().filter(function() {
                return this.nodeType == 3;
            }).text()
        }));
        $(".dropdown dd ul li").each(function() {
            $("#catselect").append($("<option/>", {
                value: $(this).find(".value").text(),
                text: $(this).find('a').first().contents().filter(function() {
                    return this.nodeType == 3;
                }).text()
            }));
            $("#catselect, #content-text-ta").bind("keyup change click", validateForm);
        });​
    

    Live Demo | Source

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

Sidebar

Related Questions

I have an enquiry form on a site, which has been working for a
I have been working on a form which has 2 combo fields and one
I have been working to build a complex data structure which would return a
I have been working on some more complex form where the fields are shown
Have been working on this question for a couple hours and have come close
I have been working with SQL Server as a Developer a while. One thing
I have been working on a large java application. It is quite parallel, and
I have been working on this app for at least 3-4 months and just
I have been working on a project in C# (.net4). Project pretty much allows
I have been working on a project on and off, but I haven't touched

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.