I already succeeded in making alert if the box is left empty or not filled in. All of my codes are working except for the GENDER and GRADE. For GENDER they have to tick to select. For Grade they have to select on the drop down menus. Here are my codes.

function validation()
{
    if(document.form1.first_name.value=="")
    {
       alert("Please enter your first name.");
       document.form1.first_name.focus();
       return false;
    }
    if(document.form1.last_name.value=="")
    {
       alert("Please enter your last name.");
       document.form1.last_name.focus();
       return false;
    }
    if(document.form1.gender.value=="")
    {
       alert("Please select your gender.");
       document.form1.gender.focus();
       return false;
    }
 if(document.form1.grade.value=="")
    {
       alert("Please select your grade.");
       document.form1.grade.focus();
       return false;
    } 

First name, last name and others are working except for Grades and Gender. Please help me

sorry my fault: The gender is radio button. One is selected by default i must be wrong it must not be compulsory. The only problem left is the Grade where there is a drop down menu namely Grade 7, Grade 8, grade 9, etc.. The default is the word "SELECT". What i wanted is the user will be alerted that he/she must select valid Grade in case of leaving it default

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.