Basics – Functions and Form Validation
Prerequisites
You should have knowledge of – or mastered the basic javascript material at Lecture – Basics – Javascript variables and scope and Lecture – Basics – Javascript Arrays
Summary
Topics covered:
1. Form Validation using Javascript
Video
http://www.youtube.com/watch?v=SPNLJBykUzc
Reference Materials
<!DOCTYPE html> <html> <head> <title>Form Example</title> <script type=”text/javascript”> function ValidateForm() { var fname = document.forms[“inputForm”][“fname”].value; if (!ValidateNotBlank(fname, “Name” )) return false;var bday = document.forms[“inputForm”][“bday”].value; if (!ValidateNotBlank(bday, “Date” )) return false; if (!ValidateDate()) return false; function ValidateNotBlank(val, message) function ValidateDate() if (d_as_date > today) <form name=”inputForm” onsubmit=”return ValidateForm();” method=”post” action=”mailto:eaglinr@daytonastate.edu” > |