SlideShare a Scribd company logo
Lecture 17
You will learn in this Lecture

FormValidation
     - Text Box validation
     - Check Box validation
     - Password validation
     - select list box validation

Before starting with this lecture, There are few questions that deserve to be
answered, What is validation and Why is it requried? Let me answer the first
question and then we will move on to the second question.

So, the first question is, What is validation?
Validation test for required strings contain a specific value, a range of accepted
value or a pattern of acceptable format. For example, If you make a form, and
ask the user to enter name, email address, and comment. If he leaves every field
blank, and click Enter. You will not get any information.
This means we are validating (checking) the values entered by the user, if he has
entered some value or not, if not, then ask him to enter the value and if he has
entered wrong value,then ask him to enter the correct value.

I hope you must have got the answer, why validation is required.

Next question is How validation is done, just read the following lines.

So, as soon as the user clicks Enter, There are two possibilites

1. Send the data that use has entered to the server, and check the values, if
there are any, if there are no values entered by him or if wrong values are
entered by him, ask him to enter the value, and move back to the same form.

2. Or, before sending the data to the server, check whether user has entered any
value or not. If he has entered the value, then the value is corrent or not.

Second method is what we will follow, and is called as client side scripting,
whereas the first method is called as Serve side scripting. JavaScript is popular
for client side scripting and ASP, JSP, PHP are popular for server side scripting.
It is high time to understand the difference between Client Side Scripting and
Server Side Scripting.

When we use a scripting language, that works on the server side, it is called as
Server Side Scripting language,
If we use a scripting language, that works on client side (i.e. browser), it is called
as Client Side Scripting language.
So, Now let us start with validating user input.

When we make a form, we ask the user to enter username, password, and may
ask him to fill up some check boxes, radio butons, and also ask him to write
some comments. It is compulsay for the user to enter username, and password,
but it is not compulsay for him to give his comments. So the things that are
compulsary, cannot be left blank. This is one of the validation, forcing the user
not to leave a field blank.

Let me list down some of the common validations needed
- Password Validation
- Text Field not blank (Name)

Below is the code for Text Box validation
<html>
<head>
      <script language="JavaScript">

       function validate()
       {
       firstName=document.myForm.fname.value;
       lastName=document.myForm.fname.value;
       if(firstName=="")
                window.alert("Name Field cannot be left blank");
       if(lastName=="")
                window.alert("Name Field cannot be left blank");
       switch (firstName.charAt(0))
       {
                case "0":
                case "1":
                case "2":
                case "3":
                case "4":
                case "5":
                case "6":
                case "7":
                case "8":
                case "9": window.alert("First chaaracter cannot be a number");
       }
       }

      </script>
</head>
      <body>
      <form name="myForm">
<input type="text" name="fname"> <br>
            <input type="text" name="lname"> <br>
            <input type="submit" onClick="validate()"> <br>
      </form>
      </body>
</html>

And, Now we have the code for Password Validation
<html>
<head>
      <script language="JavaScript">

      function validate()
      {
      passwd=document.myForm.pass;
      cpasswd=document.myForm.cpass;
      if (passwd=="")
              window.alert("Password field cannot be blank");
      if (cpasswd=="")
              window.alert("Confirm Password field cannot be blank");

      if (passwd!=cpasswd)
              window.alert("Passwords dont match");
      }

      </script>
</head>
      <body>
      <form name="myForm">
             Password<input type="password" name="pass"> <br>
             Confirm password<input type="password" name="cpass"> <br>
             <input type="submit" onClick="validate()"> <br>
      </form>
      </body>
</html>

Validate Selection List

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function validateForm(objForm)
{
       var returnStatus = 1;
if (objForm.Make.selectedIndex == 0) {
      alert("Please select a car make");
      returnStatus = 0;
      }
      else
      alert("You selected" +
objForm.Make.options[objForm.Make.selectedIndex].text + objForm.Make.value);

      if (returnStatus) {
      objForm.submit();
      }
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<FORM ACTION="test.asp" NAME="testform">
<SELECT NAME="Make">
       <OPTION VALUE="0" SELECTED>Select One</OPTION>
       <OPTION VALUE="1">Ford</OPTION>
       <OPTION VALUE="2">Chevy</OPTION>
       <OPTION VALUE="3">Pontiac</OPTION>
       <OPTION VALUE="4">Dodge</OPTION>
</SELECT>
<INPUT TYPE="BUTTON" VALUE="Send form"
onClick="validateForm(document.testform)">
</FORM>
</BODY>
</HTML>

Dynamically Populating a Selectin List

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function populate(objForm)
{


      if (objForm.Make.selectedIndex == 0)
      {
      alert("Please select a car make");
      }
      else
      {
alert("You selected" +
objForm.Make.options[objForm.Make.selectedIndex].text + objForm.Make.value);
      if (objForm.Make.selectedIndex == 1)
      {
              objForm.Type.length=2;
              objForm.Type.options[0].text="d1";
              objForm.Type.options[0].value="1";

            objForm.Type.options[1].text="d2";
            objForm.Type.options[1].value="2";
      }

      if (objForm.Make.selectedIndex == 2)
      {
              objForm.Type.length=2;
              objForm.Type.options[0].text="h1";
              objForm.Type.options[0].value="1";

            objForm.Type.options[1].text="h2";
            objForm.Type.options[1].value="2";
      }

      if (objForm.Make.selectedIndex == 3)
      {
              objForm.Type.length=3;
              objForm.Type.options[0].text="m1";
              objForm.Type.options[0].value="1";

            objForm.Type.options[1].text="m2";
            objForm.Type.options[1].value="2";

            objForm.Type.options[2].text="m3";
            objForm.Type.options[2].value="3";
      }

      if (objForm.Make.selectedIndex == 4)
      {
              objForm.Type.length=4;
              objForm.Type.options[0].text="v1";
              objForm.Type.options[0].value="1";

            objForm.Type.options[1].text="v2";
            objForm.Type.options[1].value="2";

            objForm.Type.options[2].text="v3";
            objForm.Type.options[2].value="3";
objForm.Type.options[3].text="v4";
            objForm.Type.options[3].value="4";
      }



      }



}
// -->
</SCRIPT>
</HEAD>
<BODY>
<FORM ACTION="test.asp" NAME="testform">
<SELECT NAME="Make" onChange="populate(document.testform)">
       <OPTION VALUE="0" SELECTED>Select One</OPTION>
       <OPTION VALUE="1">Daewoo</OPTION>
       <OPTION VALUE="2">Hyundae</OPTION>
       <OPTION VALUE="3">Mercedes</OPTION>
       <OPTION VALUE="4">Volswagen</OPTION>
</SELECT>

<SELECT NAME="Type">
</SELECT>
<INPUT TYPE="BUTTON" VALUE="Send form"
onClick="validateForm(document.testform)">
</FORM>
</BODY>
</HTML>

Validating a Check Box

More Related Content

What's hot (20)

PPT
Form validation server side
Mudasir Syed
 
PPT
28,29. procedures subprocedure,type checking functions in VBScript
VARSHAKUMARI49
 
PPTX
Java scriptfunction
Jesus Obenita Jr.
 
PPT
30,31,32,33. decision and loop statements in vbscript
VARSHAKUMARI49
 
PPT
Java script -23jan2015
Sasidhar Kothuru
 
PPTX
Java Script
Kalidass Balasubramaniam
 
PPT
Html JavaScript and CSS
Radhe Krishna Rajan
 
PPTX
Java script
Shyam Khant
 
PPTX
Java script basics
Shrivardhan Limbkar
 
PPTX
Produce Cleaner Code with Aspect-Oriented Programming
PostSharp Technologies
 
PDF
Intro to JavaScript
Jussi Pohjolainen
 
PPT
Java script
vishal choudhary
 
PPT
PHP - Introduction to PHP Forms
Vibrant Technologies & Computers
 
PPT
05 html-forms
Palakshya
 
ODP
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...
Nagios
 
PPTX
Java script basic
Ravi Bhadauria
 
PDF
Writing clean code
Angel Garcia Olloqui
 
PDF
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
Ravi Bhadauria
 
PDF
Javascript
Aditya Gaur
 
PDF
Javascript
Rajavel Dhandabani
 
Form validation server side
Mudasir Syed
 
28,29. procedures subprocedure,type checking functions in VBScript
VARSHAKUMARI49
 
Java scriptfunction
Jesus Obenita Jr.
 
30,31,32,33. decision and loop statements in vbscript
VARSHAKUMARI49
 
Java script -23jan2015
Sasidhar Kothuru
 
Html JavaScript and CSS
Radhe Krishna Rajan
 
Java script
Shyam Khant
 
Java script basics
Shrivardhan Limbkar
 
Produce Cleaner Code with Aspect-Oriented Programming
PostSharp Technologies
 
Intro to JavaScript
Jussi Pohjolainen
 
Java script
vishal choudhary
 
PHP - Introduction to PHP Forms
Vibrant Technologies & Computers
 
05 html-forms
Palakshya
 
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...
Nagios
 
Java script basic
Ravi Bhadauria
 
Writing clean code
Angel Garcia Olloqui
 
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
Ravi Bhadauria
 
Javascript
Aditya Gaur
 
Javascript
Rajavel Dhandabani
 

Viewers also liked (17)

DOC
Html basics 6 image
H K
 
DOC
Java script frame history
H K
 
PDF
Java script objects 2
H K
 
PPT
Week5
H K
 
DOC
Lecture4 isoosi
H K
 
DOC
Lecture2 networkclassification
H K
 
PDF
Assignment4
H K
 
PDF
Assignment sw
H K
 
PDF
Solution2
H K
 
PDF
Set
H K
 
DOC
Lecture1 introductiontonetwork
H K
 
DOC
Html basics 3 font align
H K
 
PDF
Induction
H K
 
DOC
Html basics 10 form
H K
 
DOC
Html basics 1
H K
 
DOC
Html basics 7 table
H K
 
PPT
Week7
H K
 
Html basics 6 image
H K
 
Java script frame history
H K
 
Java script objects 2
H K
 
Week5
H K
 
Lecture4 isoosi
H K
 
Lecture2 networkclassification
H K
 
Assignment4
H K
 
Assignment sw
H K
 
Solution2
H K
 
Set
H K
 
Lecture1 introductiontonetwork
H K
 
Html basics 3 font align
H K
 
Induction
H K
 
Html basics 10 form
H K
 
Html basics 1
H K
 
Html basics 7 table
H K
 
Week7
H K
 
Ad

Similar to Html basics 11 form validation (20)

DOCX
Chat php
Sigit Ariyanto
 
PPT
Javascript
Manav Prasad
 
PPTX
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
PPTX
Javascript 101
Shlomi Komemi
 
PDF
CSS-three years solved model paper msbte
vemulasairaj10
 
PPT
Javascript1
anas Mohtaseb
 
PPTX
PHP Form Validation Technique
Morshedul Arefin
 
PPTX
unit4 wp.pptxjvlbpuvghuigv8ytg2ugvugvuygv
utsavsd11
 
PPTX
javascript.pptx
hasiny2
 
PDF
2013-06-25 - HTML5 & JavaScript Security
Johannes Hoppe
 
DOCX
Introduction of javascript
syeda zoya mehdi
 
PPT
Form demoinplaywithmysql
Knoldus Inc.
 
PDF
phptut2
tutorialsruby
 
PDF
phptut2
tutorialsruby
 
PDF
phptut2
tutorialsruby
 
PDF
phptut2
tutorialsruby
 
DOCX
Unit 2_Blacklisting & Whitelisting User Input in Python.docx
ChatanBawankar
 
PPTX
Basics of Java Script (JS)
Ajay Khatri
 
PDF
full stack practical assignment msc cs.pdf
HulkTheDevil
 
PPT
JavaScript Training
Ramindu Deshapriya
 
Chat php
Sigit Ariyanto
 
Javascript
Manav Prasad
 
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Javascript 101
Shlomi Komemi
 
CSS-three years solved model paper msbte
vemulasairaj10
 
Javascript1
anas Mohtaseb
 
PHP Form Validation Technique
Morshedul Arefin
 
unit4 wp.pptxjvlbpuvghuigv8ytg2ugvugvuygv
utsavsd11
 
javascript.pptx
hasiny2
 
2013-06-25 - HTML5 & JavaScript Security
Johannes Hoppe
 
Introduction of javascript
syeda zoya mehdi
 
Form demoinplaywithmysql
Knoldus Inc.
 
phptut2
tutorialsruby
 
phptut2
tutorialsruby
 
phptut2
tutorialsruby
 
phptut2
tutorialsruby
 
Unit 2_Blacklisting & Whitelisting User Input in Python.docx
ChatanBawankar
 
Basics of Java Script (JS)
Ajay Khatri
 
full stack practical assignment msc cs.pdf
HulkTheDevil
 
JavaScript Training
Ramindu Deshapriya
 
Ad

More from H K (20)

PDF
Assignment4
H K
 
DOCX
Assignment3
H K
 
PDF
Solution3
H K
 
DOCX
Mid-
H K
 
PDF
Assignment4
H K
 
PDF
Dm assignment3
H K
 
PPT
Proof
H K
 
PDF
Resolution
H K
 
DOCX
Assignment description
H K
 
PDF
Dm assignment2
H K
 
PDF
Dm assignment1
H K
 
PPTX
Logic
H K
 
DOCX
Introduction
H K
 
PDF
Assignment 2 sol
H K
 
PDF
Assignment sw solution
H K
 
PDF
Violinphoenix
H K
 
PDF
Ie project
H K
 
PDF
Assignment cn subnetting
H K
 
PDF
Assignment uplaodfile
H K
 
PDF
Assignment sw
H K
 
Assignment4
H K
 
Assignment3
H K
 
Solution3
H K
 
Mid-
H K
 
Assignment4
H K
 
Dm assignment3
H K
 
Proof
H K
 
Resolution
H K
 
Assignment description
H K
 
Dm assignment2
H K
 
Dm assignment1
H K
 
Logic
H K
 
Introduction
H K
 
Assignment 2 sol
H K
 
Assignment sw solution
H K
 
Violinphoenix
H K
 
Ie project
H K
 
Assignment cn subnetting
H K
 
Assignment uplaodfile
H K
 
Assignment sw
H K
 

Recently uploaded (20)

PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PPTX
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
Difference between write and update in odoo 18
Celine George
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
epi editorial commitee meeting presentation
MIPLM
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Introduction to Indian Writing in English
Trushali Dodiya
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Controller Request and Response in Odoo18
Celine George
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
Difference between write and update in odoo 18
Celine George
 

Html basics 11 form validation

  • 1. Lecture 17 You will learn in this Lecture FormValidation - Text Box validation - Check Box validation - Password validation - select list box validation Before starting with this lecture, There are few questions that deserve to be answered, What is validation and Why is it requried? Let me answer the first question and then we will move on to the second question. So, the first question is, What is validation? Validation test for required strings contain a specific value, a range of accepted value or a pattern of acceptable format. For example, If you make a form, and ask the user to enter name, email address, and comment. If he leaves every field blank, and click Enter. You will not get any information. This means we are validating (checking) the values entered by the user, if he has entered some value or not, if not, then ask him to enter the value and if he has entered wrong value,then ask him to enter the correct value. I hope you must have got the answer, why validation is required. Next question is How validation is done, just read the following lines. So, as soon as the user clicks Enter, There are two possibilites 1. Send the data that use has entered to the server, and check the values, if there are any, if there are no values entered by him or if wrong values are entered by him, ask him to enter the value, and move back to the same form. 2. Or, before sending the data to the server, check whether user has entered any value or not. If he has entered the value, then the value is corrent or not. Second method is what we will follow, and is called as client side scripting, whereas the first method is called as Serve side scripting. JavaScript is popular for client side scripting and ASP, JSP, PHP are popular for server side scripting. It is high time to understand the difference between Client Side Scripting and Server Side Scripting. When we use a scripting language, that works on the server side, it is called as Server Side Scripting language, If we use a scripting language, that works on client side (i.e. browser), it is called as Client Side Scripting language.
  • 2. So, Now let us start with validating user input. When we make a form, we ask the user to enter username, password, and may ask him to fill up some check boxes, radio butons, and also ask him to write some comments. It is compulsay for the user to enter username, and password, but it is not compulsay for him to give his comments. So the things that are compulsary, cannot be left blank. This is one of the validation, forcing the user not to leave a field blank. Let me list down some of the common validations needed - Password Validation - Text Field not blank (Name) Below is the code for Text Box validation <html> <head> <script language="JavaScript"> function validate() { firstName=document.myForm.fname.value; lastName=document.myForm.fname.value; if(firstName=="") window.alert("Name Field cannot be left blank"); if(lastName=="") window.alert("Name Field cannot be left blank"); switch (firstName.charAt(0)) { case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": window.alert("First chaaracter cannot be a number"); } } </script> </head> <body> <form name="myForm">
  • 3. <input type="text" name="fname"> <br> <input type="text" name="lname"> <br> <input type="submit" onClick="validate()"> <br> </form> </body> </html> And, Now we have the code for Password Validation <html> <head> <script language="JavaScript"> function validate() { passwd=document.myForm.pass; cpasswd=document.myForm.cpass; if (passwd=="") window.alert("Password field cannot be blank"); if (cpasswd=="") window.alert("Confirm Password field cannot be blank"); if (passwd!=cpasswd) window.alert("Passwords dont match"); } </script> </head> <body> <form name="myForm"> Password<input type="password" name="pass"> <br> Confirm password<input type="password" name="cpass"> <br> <input type="submit" onClick="validate()"> <br> </form> </body> </html> Validate Selection List <HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- function validateForm(objForm) { var returnStatus = 1;
  • 4. if (objForm.Make.selectedIndex == 0) { alert("Please select a car make"); returnStatus = 0; } else alert("You selected" + objForm.Make.options[objForm.Make.selectedIndex].text + objForm.Make.value); if (returnStatus) { objForm.submit(); } } // --> </SCRIPT> </HEAD> <BODY> <FORM ACTION="test.asp" NAME="testform"> <SELECT NAME="Make"> <OPTION VALUE="0" SELECTED>Select One</OPTION> <OPTION VALUE="1">Ford</OPTION> <OPTION VALUE="2">Chevy</OPTION> <OPTION VALUE="3">Pontiac</OPTION> <OPTION VALUE="4">Dodge</OPTION> </SELECT> <INPUT TYPE="BUTTON" VALUE="Send form" onClick="validateForm(document.testform)"> </FORM> </BODY> </HTML> Dynamically Populating a Selectin List <HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- function populate(objForm) { if (objForm.Make.selectedIndex == 0) { alert("Please select a car make"); } else {
  • 5. alert("You selected" + objForm.Make.options[objForm.Make.selectedIndex].text + objForm.Make.value); if (objForm.Make.selectedIndex == 1) { objForm.Type.length=2; objForm.Type.options[0].text="d1"; objForm.Type.options[0].value="1"; objForm.Type.options[1].text="d2"; objForm.Type.options[1].value="2"; } if (objForm.Make.selectedIndex == 2) { objForm.Type.length=2; objForm.Type.options[0].text="h1"; objForm.Type.options[0].value="1"; objForm.Type.options[1].text="h2"; objForm.Type.options[1].value="2"; } if (objForm.Make.selectedIndex == 3) { objForm.Type.length=3; objForm.Type.options[0].text="m1"; objForm.Type.options[0].value="1"; objForm.Type.options[1].text="m2"; objForm.Type.options[1].value="2"; objForm.Type.options[2].text="m3"; objForm.Type.options[2].value="3"; } if (objForm.Make.selectedIndex == 4) { objForm.Type.length=4; objForm.Type.options[0].text="v1"; objForm.Type.options[0].value="1"; objForm.Type.options[1].text="v2"; objForm.Type.options[1].value="2"; objForm.Type.options[2].text="v3"; objForm.Type.options[2].value="3";
  • 6. objForm.Type.options[3].text="v4"; objForm.Type.options[3].value="4"; } } } // --> </SCRIPT> </HEAD> <BODY> <FORM ACTION="test.asp" NAME="testform"> <SELECT NAME="Make" onChange="populate(document.testform)"> <OPTION VALUE="0" SELECTED>Select One</OPTION> <OPTION VALUE="1">Daewoo</OPTION> <OPTION VALUE="2">Hyundae</OPTION> <OPTION VALUE="3">Mercedes</OPTION> <OPTION VALUE="4">Volswagen</OPTION> </SELECT> <SELECT NAME="Type"> </SELECT> <INPUT TYPE="BUTTON" VALUE="Send form" onClick="validateForm(document.testform)"> </FORM> </BODY> </HTML> Validating a Check Box