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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:14:49+00:00 2026-06-01T10:14:49+00:00

I have the following code; I want to make sure that submit does not

  • 0

I have the following code; I want to make sure that submit does not actually post to the page specified by action unless one of the two radio inputs has been selected. I have tried multiple variations of this and other code, and cannot seem to figure out whats wrong. Whether the radio buttons are selected or not it still posts to somepage.py.

<html>
    <head>
        <title>
            Test Page
        </title>
        <script language="JavaScript">
            function validate(formEntry) {

                if (formEntry.Q1.q11.checked != true && formEntry.Q1.q12.checked != true)
                    return false;

                return true;
            } 
        </script>
    </head>
    <body>
        <form action="somepage.py" method="POST" onsubmit="return validate(this);">
            <input type="radio" name="Q1" id="q11" value="1" />
            <input type="radio" name="Q1" id="q12" value="2" />
            <input type="submit" name="Submit" />
        </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-06-01T10:14:50+00:00Added an answer on June 1, 2026 at 10:14 am

    If you make one button checked by defualt, then one will always be checked:

    <input type="radio" name="Q1" id="q11" value="1" checked>
    <input type="radio" name="Q1" id="q12" value="2" > 
    

    Or the function can be simply:

    function validate(formEntry) {
        return formEntry.Q1[0].checked || formEntry.Q1[1].checked ;
    }
    

    if either is checked it will return true, otherwise false.

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

Sidebar

Related Questions

I have the following code which I want to use to make sure that
I have some code (that is working), but I just want to make sure
I have the following assembly code on Windows and I want to make sure
I want to make sure that an image in my application is not more
I have a checkbox list for weekdays and I want to make sure that
I have following code and i want to pass additional parameter in JSON.getJSONfromURL() method
I have the following code I want to run, but the problem is $this->type
I want to know is below code correct ? I have following code which
I have the following code: [ [NSDate date] descriptionWithLocale: @yyyy-MM-dd ] I want it
I have the following code, which I want to load values on a selection

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.