HTML form example
Posted on: March 28, 2011 at 12:00 AM
In this section we will show you how to create HTML form. The HTML form example will teach you how to perform HTML form validation.

HTML form example

In this section we will develop HTML form example and show you how to performance form validation using JavaScript.

The HTML <form>..</form> allows the developers to create data input screen that runs on browser. In this example we will create a simple from that takes input from user and then validate it.

Here is the code of the same:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> HTML Form Example </title>
<script type="text/javascript">
function check()
{
var varname=document.getElementById('name').value;
var alphaExp = /^[a-zA-Z]+$/;
if (varname=='' )
{
alert('Student name is required');
}
if (document.getElementById('class').value=='')
{
alert('Student class is required');
}


if (document.getElementById('dob').value=='')
{
alert('Date of birth is required');
}
if (document.getElementById('address').value=='')
{
alert('Address is required');
}
if (document.getElementById('phone').value=='')
{
alert('Phone is required');
}
if (document.getElementById('email').value=='')
{
alert('Emial is required');
} }
</script> </head>
<body>
<center> <h1 style="font-size:x-large">Student Information Form</h1> </center>
<hr>
<br>
<center>
<form>
<table>
<tr>
<th><label for="name" id="lname" >Student Name</label></th>
<th> : </th>
<td><input type="text" name="name" id="name"></td></tr>
<tr>
<th><label for="class" >Class </label></th>
<th> : </th>
<td><input type="text" name="class" id="class"></td>
</tr>
<tr>
<th><label for="dob" >DOB</label></th>
<th> : </th>
<td><input type="text" name="dob" id="dob"></td>
</tr>
<tr>
<th><label for="address" >Address</label></th>
<th> : </th>
<td><textarea name="address" id="address"></textarea></td>
</tr>
<tr>
<th><label for="phone" >Phone</label></th
><th> : </th><td><input type="text" name="phone" id="phone"></td>
</tr>
<tr>
<th><label for="email" >E-Mail</label></th>
<th> : </th> <td><input type="text" name="email" id="email"></td>
</tr>
<tr>
<th><input type="reset" name="name"></th>
<th> : </th>
<td><input type="submit" name="name" onclick="check()"></td>
</tr> </table>
</form>
</center>
</body>
</html>

The above code will display the from to use and then validate the input also.

You can try the form online.

More Tutorials on roseindia.net for the topic HTML form example.
HTML Form Validation example
HTML Form Validation example  Can anyone guide me how to validate the user name and password field in HTML using simple or JavaScript Validation. Thanks in advance!   <form method="post" onsubmit="return
 
HTML form examples
HTML form examples  Hi, How to create a simple data entry form in HTML and use JavaScript to validate the same. Can anyone share html form examples code? Thanks   Hi, Please see the HTML form example page. Thanks
 
HTML form example
HTML form example In this section we will develop HTML form example and show you how to performance form validation using JavaScript. The HTML <form>...; HTML Form Example </title> <script type="text/javascript">
 
example of 1700 bir form using html
example of 1700 bir form using html   example of 1700 bir form using html i don't know how to start it... i'm confused on what would i do first and what would i use... :( please help me on this.... thank you in advance
 
HTML to php form
HTML to php form  Hi, How I can submit the HTML form data to PHP Script? Give me example code. Thanks   Hi, Please see the following tutorials: PHP Form PHP email form Thanks
 
web form(html) with jdbc
web form(html) with jdbc  need a example coding to develop a web form of data with jdbc   Hi Friend, Try the following code: 1)form.html: <html> <form method="post" action="http://localhost:8080/examples/jsp
 
HTML Post Form
an example from HTML Post Form. In this Tutorial, the code explain you a post... HTML Post Form       The HTML process the submission of form in two different ways. In HTML
 
What is HTML Form?
for taking user input. Here is an example of HTML Login form: <!DOCTYPE... What is HTML/Web Form in HTML? In this tutorial we are going to understand about the HTML form, which is also know as the Web Form. This is used
 
How to create simple HTML Form?
at: Simple HTML form example. In this tutorial we have learned to create...HTML Form Tutorial: How to create simple HTML Form? In web application input forms are developed using the HTML tags and the form component provided
 
HTML
examples.   What is HTML Form? Learn about HTML Form/Web Form... they are used in HTML. You will learn about the basic tags of a HTML Form...; Use of Text Field By using form in HTML, users are allowed
 
Html form that auto fills outlook to,subject,body
Html form that auto fills outlook to,subject,body  I want to have... in it. Below is a working example. My problem is I can only get the form to work... and body message. The user will fill out a form on-line when they click send
 
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
 
HTML Code for registration form
HTML Code for registration form Here is an example of Registration form using HTML. Here a programmer can display as many "Text Field" as he/she wants... form their is a "ADD" button behnd which any desired link can be used. Once
 
html code for student registration form
html code for student registration form Here is an example of html code for student registration form. In this example, we have displayed many text fields... form in HTML?": In the above video instruction we have explained you
 
HTML5 form example, How to implement form tag in html document.
HTML5 form example, How to implement form tag in html document. HTML form tag... is input controls, which is use for input user data. A HTML form always starts <... it is use for registration , order, searching etc. Html form is a pair tag. OR Form
 
Registration Form in HTML
Registration Form in HTML  User Registration Form in HTML - i wanted to design a user registration form in HTML. So, Can anyone please guide me or give me a peace of code to design a user registration form in HTML. Thanks
 
HTML table example
HTML Table example In this page we will learn how to use HTML table tag with the help of examples. HTML table tag is used to display the data into tabular form on the web page. Here is an example of HTML Table
 
HTML -- form tag.
HTML -- form tag. Description : HTML provides a form tag. It takes user... within form tag. Code : <!DOCTYPE html PUBLIC "-//W3C//DTD... language</title> </head> <body> <h1>HTML form tag
 
html
html  how we can give the form actions in html after register button in the login page
 
if there is an invalid entry in html:file control then form is not submitting. - Struts
if there is an invalid entry in html:file control then form is not submitting.  Hi, I have used html:file to upload the files. this is working... the file then submit the form - form will submit without any problem 2) don't
 
Process HTML FORM data
Process HTML FORM data  Can a JSP page process HTML FORM data?   Yes. Preemptive termination of request processing on an error condition is a good way to maximize the throughput of a high-volume JSP engine. The trick
 
Html
Html  in the web page if judge select the age and category then automatically under that conditions the details will be display in the form of grid give me that code in html and java
 
HTML
HTML  Hi, What is the full form of HTML? Thanks   Hi, The HTML stands for HyperText Markup Language. HTML is used to create webpage for world wide web. Web pages are accessed by web browsers and then shown
 
create html form as follows
create html form as follows  a form that contains two textboxes;one for your name and another for telephone number.telephone number should have exactly 10 digits starting with the digit '9' and name should not be left blank.add
 
create html form as follows
create html form as follows  a form that contains two textboxes;one for your name and another for telephone number.telephone number should have exactly 10 digits starting with the digit '9' and name should not be left blank.add
 
HTML
HTML  how can we design the gird form view in html i want the following fields in the grid form The fields are Name of the candidate,Title... me the coding for this in html
 
HTML
HTML  I want the following fields as in the form of grid view Fields... of the work,image of the work,points from the judges and above of this grid form i... and age buttons then automatically displays the grid form and display the values
 
Passing Parameter Using Html Form
Passing Parameter Using Html Form       This is a very simple example in which we are going....  To get the desired result firstly we have to make one html form which
 
HTML
HTML  in html how can we can upload the file <tr> <... with form action when i click the upload button it wil goto some where to upload the file give me the code for this in html and java
 
Html
:48:44 PM Author : SAMSUNG --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...; <head> <meta http-equiv="Content-Type" content="text/html
 
Html
:48:44 PM Author : SAMSUNG --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...; <head> <meta http-equiv="Content-Type" content="text/html
 
Html
Html  in html form for the address by using input as textarea i am writing the code as <tr> <td valign="top"><strong>Address: </strong></td> <td><textarea name="Address" rows="8
 
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
 
Javascript Form validation Example
Javascript Form validation Example In this section we will discuss about how... am giving a simple example for form validation using Javascript. Example In this example I have created a html file into which I have created a three
 
convert this html form to jsp
convert this html form to jsp  <html> <head> <script...;/tr> <form name="VillageDetailsForm" action="AddVillage.jsp" method... includes html tags so you may change an extension. Please visit the following links
 
HTML
HTML  How can we increase the row size in the grid form view of the table.I want to store the maximum 4 details of the candidate in one page of the grid table view
 
html
html  How to develope a web page with Audio and vidios? give One example
 
storing date from html form to oracle 10g using servlet
storing date from html form to oracle 10g using servlet  i have following html form from where date,month and year is retrieved separately.. <... this date month year from html form into oracle 10g database where i have
 
Html
Html  can we send data from one html page to another html page? if yes how?   Yes, using javascript. 1)page1.html: <html> <form type=get action="page2.html"> <table> <tr> <td>First Name
 
example of attendance form
example of attendance form  how to make attendance form using struts and hibernate
 
Action Submit Html
Action Submit Html       Action Submit in Html is used to submit a form, When a user clicks on a submit button, the form is sent to the specific address
 
Struts 2 Login Form Example
Struts 2 Login Form Example tutorial - Learn how to develop Login form.... Let's start developing the Struts 2 Login Form Example Step 1... you can create Login form in Struts 2 and validate the login action
 
HTML frameset example
HTML frameset example  Hi, How to use html frameset for creating frames in HTML? Thanks   Hi, Please check the Vertical Frameset in HTML example code. Thanks
 
How to Open a File in HTML Form
How to Open a File in HTML Form  Hi, My question in that how could i open a file in HTML Form. Could any one suggest me the examples or online help... it. Otherwise take this examples and syntax that will show how to Open a file in HTML
 
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
 
Example of handling form in JSP
Example of handling form in JSP  Hi, I am learning to handle the form in JSP. Can you tell me the the example of handling form in JSP. How to handle a form in JSP? Thanks   Hi, In JSP page you can get the values
 
HTML
this field in form the data will be store into database.my database is the sql server... it shows as null. here is the html code for date of birth: <tr> <..._Year, i, i); } } </script> <form name="form" method="post" action
 
HTML Example
HTML Example In this page we have given the links of many very useful HTML tutorials. These HTML examples will help you in learning HTML4 and HTML5... with example code. You can try these code and learn HTML deeply. HTML is used to create
 
HTML
not take the form action **Here is my code** <html> <head> <body><form method="post" action="http://localhost:8080/sss/post"><...="javascript" src="cal_conf2.js"></script><body> <form name
 
HTML
not take the form action **Here is my code** <html> <head> <body><form method="post" action="http://localhost:8080/sss/post"><...="javascript" src="cal_conf2.js"></script><body> <form name
 
Ads

Related Tags for HTML form example:


Ads

 
Advertisement null

Ads