Thinking Web Publishing? Think www.YouNeedItAll.com!

Website Search

Translate Web Page

Google-Translate-Chinese (Simplified) BETA Google-Translate-English to French Google-Translate-English to German Google-Translate-English to Italian Google-Translate-English to Japanese BETA Google-Translate-English to Korean BETA Google-Translate-English to Russian BETA Google-Translate-English to Spanish

Social Media Networking

Geo Twitter Map
See who Twits in your area

web design, web development and web technology news
Business Networking and Social Media Networking Clients and Partners:
Nikolay Web DesignerNikolay Mikychkin History of Paintings sharper web design Think Beyond Labels HD RADIO USA - HD   TV Used   Cars Syracuse 2012   Phenomenon Beyond Web Design Custom Design   labels CATERING in New   York Attorney At Law Web Site Domain   Name Video News Search cars arriveVashchenko Family Leonardo   da Vinci  custom FOOD labels and personalised CRAFT LabelsCatering in  SyracusePersonalized  Labels European Food in   CNYSyracuse Web Designer, New York website designer Custom Web Design Custom Design Labels Renaissance HistorySoftware on the Fly Upstate Pizza Web Search Engines Laser Cut it All Web Site Design Agency in New Yorktwitter user directory Verified AccountFree Web Templates, free css styles ideasI do Web Design NY Web Search Engines Visual Search, how searsh engines work? fundrasing ideas

Personalize Your Business

Da Vinci Art Gallery

LEONARDO DA VINCI's Art Gallery, Live, Paintings, Inventions, Secrets and History of Renaissance

Web Templates Sale

History of Painting


Stylistic Periods in Western Art History Major Art Movements in Western Art History
Stylistic Periods in Western Art History Major Art Movements in Western Art History

Site Statistics

Content View Hits : 635068
Web Form Validation Script
Web Development and Web Technology
Written by Nikolay Gul   

Form Validation Script

 

Summary of tests

  • First Name - This is a required field and it will be validated when it loses focus... error will be reported via alert message... This uses the basic RequiredValidator.
  • Middle Name - This is a required field and it will be validated when it loses focus... error will be reported by inserting a message into a div below the form... this uses the basic RequiredValidator.
  • Last Name - This is a field that requires a minimum sized entry (5 characters) and it will be validated every time a key is pressed and released. Note that this field starts up invalid (its label it highlighted in red) and will be made valid by entering 5 characters or more (label will revert to black) and will be made invalid again if the length falls below this minimum... This uses the basic MinLengthValidator.
  • Date Of Birth - This is a field that must be entered in the form MM/DD/YYYY and is validated when it loses focus... error will be reported by inserting a message into a div below the form. This uses an add-on validator called DateValidator.
  • eMail Address - This is a field that must be entered in the form This e-mail address is being protected from spambots. You need JavaScript enabled to view it and is validated when it loses focus... error will be reported via alert message. This uses the basic RegexFalidator.

 

First Name:  
Middle Name:  
Last Name:  
Date Of Birth:  
eMail Address:  
          

 



Other Form Validation Example.

Link: feedback.html

CODE for form (feedback.html):
<HTML>
<HEAD>
<TITLE>Vinyl Dealers: feedback</TITLE>
</HEAD>
<BODY>
<H2>Feedback</H2>
<BR>
<FORM Action=send_feedback.php Method=POST>
Your name: <INPUT Type=TEXT Name=user Size=40 Maxlength=40><BR>
Your email: <INPUT Type=TEXT Name=email Size=40 Maxlength=40><BR>
<BR>
Can we keep you updated with news about our site? <INPUT Type=RADIO Name=spam Value=1 Checked>Yes <INPUT Type=RADIO Name=spam Value=0>No<BR>
<BR>
Comments:<BR>
<TEXTAREA Name=comments Rows=10 Cols=60></TEXTAREA><BR>
<INPUT Type=SUBMIT Value=submit>
</FORM>
</BODY>
</HTML>
CODE for validation page (send_feedback.php)
<HTML>
<HEAD>
<TITLE>We appreciate your feedback</TITLE>
</HEAD>
<BODY>
<?
// check to make sure none of the variables are empty
if (!$user || !$email || !$comments) {
?>
<H2>Whoops</H2>
<BR>
Please fill in all fields.
<BR>
<A href="/feedback.html" mce_href="/feedback.html">Click here to go back to the feedback page.</A>
<?
exit;
}
// check for a valid email address format
if (!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)) {
?>
<H2>Whoops</H2>
<BR>
Please enter a valid address.
<BR>
<A href="/feedback.html" mce_href="/feedback.html">Click here to go back to the feedback page.</A>
<?
exit;
}
// escape any characters that could cause problems
$user = addslashes($user);
$email = addslashes($email);
$comments = addslashes($comments);
// connect to the database and select 'vinyldealers'
$db = mysql_connect("localhost");
mysql_select_db("vinyldealers", $db);
// add the user input to the 'feedback' table as a new record
$addfeedback = "INSERT INTO feedback (user, email, spam, comments)
VALUES ('".$user."', '".$email."', '".$spam."', '".$comments."')";
$result = mysql_query($addfeedback);
?>
<H2>Thank you</H2>
<BR>
We have added your comments to our database.
</BODY>
</HTML>
 
Web Templates Sale, Full site templates Sale, flash templates sale


Email or Call:(315) 378-9729 and Search for www.YouNeedItAll.com @ Nikolay Gul 2009 © All rights reserved