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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:19:12+00:00 2026-05-23T07:19:12+00:00

I have a form in which I want two check boxes to be required

  • 0

I have a form in which I want two check boxes to be required prior to the form posting. If either are not checked, I have it set to display a warning and prompt the user to check them. Currently, it works if both are unchecked. It also works correctly if only the first check box is unchecked. However, if the second check box, the rules check box, is the only one unchecked — the form still posts.

???? Thanks in advance.

<head>
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
function checkme() {
missinginfo = "";
if (!document.team.agree.checked) {
missinginfo += "\n - The entire team must read and agree to the rules";
}
if (missinginfo != "") {
missinginfo ="__________________________________\n" +
"Required information is missing: \n" +
missinginfo + "\n__________________________________" +
"\nEnsure everyone has read the rules and resubmit.";
alert(missinginfo);
return false;
}
else {
return true;
}
}

function checkme2() {
missinginfo2 = "";
if (!document.team.registered.checked) {
missinginfo2 += "\n - Each driver must register individually";
}
if (missinginfo2 != "") {
missinginfo2 ="__________________________________\n" +
"Required information is missing: \n" +
missinginfo2 + "\n__________________________________" +
"\nEnsure everyone has registered individually and resubmit.";
alert(missinginfo2);
return false;
}
else {
return true;
}
}
</script>
</head>

<body>
<form name="team" method="post" action="#" onSubmit="return checkme(), checkme2();">
<table cellpadding="0" cellspacing="0" border="0">
<td colspan="2" align="center"><input type="checkbox" name="registered" value="each_registered"> Each driver is already registered individually.
</td>
</tr>  
<td colspan="2" align="center"><input type="checkbox" name="agree" value="agree_terms"> The team agrees to the rules.</td>
</tr>  
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
  • 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-23T07:19:13+00:00Added an answer on May 23, 2026 at 7:19 am

    You are actually very close although I would say that you should only use a single function for validation and possibly look into using a javascript framework. It will make javascript much easier to use.

    This:

    <form name="team" method="post" action="#" onSubmit="return checkme(), checkme2();">
    

    Should be this:

    <form name="team" method="post" action="#" onSubmit="return checkme() && checkme2();">
    

    It is working here on jsfiddle

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

Sidebar

Related Questions

I have a form which I want to be 'resusable' for a variety of
I have a form which I want to submit upon button click which is
I have a form which on submit I want to run a script via
I have a form which has only tab control in it. I want to
I have an application in which there is a form which I want to
I have two DB tabels which form a parent child relationship from Planung to
I have a data entry form on my site which contains multiple checkboxes, two
I have a form in which i use two dimensional array for field names.The
I have a form on which some text fields and two buttons are displayed.
I have a form which has a RichTextBox docked to the left and DataGridView

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.