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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:38:05+00:00 2026-05-27T07:38:05+00:00

I have a function for a button which submits a form. This function checks

  • 0

I have a function for a button which submits a form. This function checks to see if the 5 checkboxes are selected #co1,#co2,#co3,#div1,#cc1.

It then also checks to see if tcaccept select is set to 1.
If so the form submits, else the alert pops up.

This is the code i have at the moment:

  $('#submit2pd').click(function(event) {
    var $finishBoxes = $('#co1,#co2,#co3,#div1,#cc1');

        if (!($finishBoxes.length == $finishBoxes.filter(':checked').length && $('#tcaccept').val() == '1' )) {
    alert('Please complete the Induction Checklist confirming that you have read and understood the Colleges main policies and procedures, agreeing to comply with these in line with the terms of your contract with the College');
            return false;
        }

        // otherwise the form is submitted
        window.location.href = "submit2pd.php";

    });

All works brilliantly, but i want to add to this line as i have another option that is required. But this needs to be an if statement.

    if (!($finishBoxes.length == $finishBoxes.filter(':checked').length && $('#tcaccept').val() == '1' && THE IF STATEMENT))

this is what i need to incorporate into the if statement above.

if ($("#ctl").val() == "1") {
$('#ctlapp') must not be blank
}
else if ($("#ctl").val() == "0") {
$('#ctlapp') can be blank
}

Any help would be greatly appreciated.

  • 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-27T07:38:05+00:00Added an answer on May 27, 2026 at 7:38 am

    How about:

    if (!($finishBoxes.length == $finishBoxes.filter(':checked').length && 
        $('#tcaccept').val() == '1' && 
        !($("#ctl").val() == "1" && $('#ctlapp').val() === "")))
    

    What we’re adding here is another condition which says, “And make sure it’s not the case that #ctl is 1, and #ctlapp is blank”.

    Edit: and please see my comment above – your question is not about jQuery, forms, or validation. It’s barely about JS.

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

Sidebar

Related Questions

I have a form with a submit button. I have called a function on
I have a form which has a input textbox and submit button. On submission
In my form I have a normal submit button which validate my form with,
I have this script which checks if the textbox input is an URL. If
I have a simple form (textbox, submit button) which is wrapped in an update
I have the following home-grown jquery plugin: (function($) { $.fn.defaultButton = function(button) { var
I have the following code bound to the click event of a button: function
I have a form which is given below : <form method=post id=contactForm action=> <fieldset
I am unable to determine which form submit button is clicked during an Ajax
I have a form which is validated through jquery, but I need the blur

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.