<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript" type="text/javascript">
//function to check empty fields
function isEmpty(textfield1, textfield2, textfield3) {
//change "field1, field2 and field3" to your field names
textfield1 = document.forms
1.field1.value
textfield2 = document.forms
1.field2.value
textfield3 = document.forms
1.field3.value
//name field
if (textfield1 == "" || textfield1 == null || !isNaN(textfield1) || textfield1.charAt(0) == ' ')
{
alert("\"Field 1\" is a mandatory field.\nPlease amend and retry.")
return false;
}
//url field
if (textfield2 == "" || textfield2 == null || textfield2.charAt(0) == ' ')
{
alert("\"Field 2\" is a mandatory field.\nPlease amend and retry.")
return false;
}
//title field
if (textfield3 == "" || textfield3 == null || textfield3.charAt(0) == ' ')
{
alert("\"Field 3\" is a mandatory field.\nPlease amend and retry.")
return false;
}
return true;
}
</script>
<body>
<form name="form1" method="post" action="">
| Name : |
<input type="text" name="textfield"> |
| Address : |
<input type="text" name="textfield2"> |
| Phone : |
<input type="text" name="textfield3"> |
| E-mail : |
<input type="text" name="textfield4"> |
<input type="submit" name="Submit" value="Submit">
<script language="JavaScript" type="text/javascript">
|
<input type="reset" name="Submit2" value="Reset"> |
</form>
</body>
</html>
Originally posted as a Categorized Answer.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.