0

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

2
Contributors
2
Replies
8
Views
2 Years
Discussion Span
Last Post by diafol
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.