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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:40:35+00:00 2026-06-17T12:40:35+00:00

I am javascript newbie, I am self learning on line home tutorials. My Javacript

  • 0

I am javascript newbie, I am self learning on line home tutorials.
My Javacript tutorial asks me to try out basic form code.

But the function checkRadio() is not posting error message!(if radio buttons Not checked – then post error message)

The function checkEmail() does correctly post error message.

I have checked syntax many times. Can you spot error/s please?

Thank you

<!DOCTYPE HTML>
<HTML>
    <HEAD>
        <TITLE>Javascript and Forms</TITLE>

        <SCRIPT LANGUAGE = "Javascript">

        function validate() {

            var emailError = checkEmail();
            var radioError = checkRadio();
            var dropdownError = checkDropdown();
            var checkboxError = checkCheckbox();

        }




        function checkEmail(){

            var email = document.frmOne.email.value;
            if(email==""){
                document.getElementById("email_error").innerHTML = "No Email Adress";
                return false;
            }
            else{
                document.getElementById("email_error").innerHTML = "";
                return true;
            }




        }

        function checkRadio(){

            var payment = "";
            var len = document.frmone.payment.length;
            var i;

            for(i = 0;i<len;i++){
                if (document.frmone.payment[i].checked){
                    payment = document.frmone.payment[i].value;
                    break;
                }
            }
            if(payment == ""){
                document.getElementById("radio_error").innerHTML = "No payment Option Selected";
                return false;
            }
            else{
                document.getElementById("radio_error").innerHTML = "";
                return true;
            }
        }







        </SCRIPT>
    </HEAD>

    <BODY>

        <FORM NAME="frmOne" ACTION="" METHOD="POST">

        <P>
            EMAIL: <INPUT TYPE="text" NAME="email" VALUE="" PLACEHOLDER="Email Address"> 
            <SPAN STYLE=color:red ID="email_error"></SPAN>
        </P>

        <P>
            Payment Options:
            <INPUT TYPE="Radio" Name="payment" Value="CC">Credit Card
            <INPUT TYPE="Radio" Name="payment" Value="DC">Debit Card
            <INPUT TYPE="Radio" Name="payment" Value="PP">PayPal 
            <SPAN STYLE=color:red ID="radio_error"></SPAN>
        </P>

        <P>
        Where did you hear about us?
        <SELECT NAME="hear">
            <OPTION Value="None">None</OPTION>
            <OPTION Value="paper">Newspaper</OPTION>
            <OPTION Value="tv">Television</OPTION>
            <OPTION Value="mouth">Word of Mouth</OPTION>
            <OPTION Value="seach">Search Engine</OPTION>
        </SELECT>
         <SPAN STYLE=color:red ID="dropdown_error"></SPAN>
        </P>

        <P>
            <LABEL FOR="CB1">Terms and Conditions</LABEL>
            <INPUT TYPE="Checkbox" Name="terms" ID="CB1" Value="TAC">
            <SPAN STYLE=color:red ID="checkbox_error"></SPAN>
        </P>

        <P>&nbsp;</P>
        <INPUT TYPE="button" VALUE="  SUBMIT  " onClick="validate()">
        </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-17T12:40:37+00:00Added an answer on June 17, 2026 at 12:40 pm

    You missed a capital letter on this line:

    len = document.frmone.payment.length;

    Should be len = document.frmOne.payment.length;

    You should learn to use your browser’s web inspector, it can help you easily spot this stuff.

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

Sidebar

Related Questions

First: I'm JavaScript newbie. So.. I have basic form with password, repeat password, email
I'm javascript newbie...please bear with me. Modified some jQuery animation code from w3c tutorial.
I am a newbie at Javascript and Jquery. I have a form that I
I am newbie. many of javascript code start with <!-- <script type=text/javascript> <!-- and
javascript newbie here, I wrote a form in html and submitted it with an
A JavaScript newbie here. I have this following code: function testObject(elem) { this.test =
Bit of a JavaScript newbie here - I am firing this basic bit of
I'm very newbie on Javascript-NodeJS-MongoDB, I try to know the number of documents found
Gotta start off by saying I'm a javascript newbie.... I borrowed some code example
Javascript newbie here, just trying to tweak this bit of code. It checks for

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.