This test shows the form within a table.
Code to make this work:
JavaScript
Much of the same code from the first Validator Example will work in this example. Such as
loading the external script and intializing it. The biggest change comes in the HTML where the form's onsubmit event handler
is used to validate the form.
HTML
This example usage of Validator uses an HTML table to store the information instead of laying out the inforamtion using CSS.
One of Validator's advantages is that it will work equally well with either form of layout.
<form action="" method="" accept-charset="utf-8" onsubmit="return validatorCheckForm(this);">
<table border="0" cellspacing="5" cellpadding="5">
<td><label for="test1">first name:
</label> (with pop-up)
</td>
<td><input id="test1" name="MyFirstName" required="required" popup="only" requirederrmsg="We need your name." /></td>
</tr>
<td><label for="test2"> last name:
</label> (with pop-up both)
</td>
<td><input id="test2" name="lastName" popup="both" required="required" /></td>
</tr>
<td>keep from too long:
</td>
<td><textarea id="longstuff" name="notToLongStuff" maxlen="95" maxwords="3">hi!
</textarea></td>
</tr>
<td><label for="short_stuff">keep from too short:
</label></td>
<td><textarea id="short_stuff" name="short_stuff" minlen="95">hi!
</textarea></td>
</tr>
<td><input id="maxNum" name="MaxValue" maxval="35" /></td>
</tr>
<td><input id="your_email" name="your_email" email="email" errmsg="Please enter a valid e-mail address." /></td>
</tr>
<td><input id="your_phone" name="your_phone" usphone="usphone" required="true" usphoneerrmsg="Please enter a valid phone number." /></td>
</tr>
<td>Something to pull down:
</td>
<select notfirst="notfirst" name="ListSelector" id="ListSelector">
<option>pick something other than me
</option>
</select>
</td>
</tr>
<td><input id="initial" name="initial" required="true" /></td>
</tr>
<td><input id="match" name="match" matches="initial" /></td>
</tr>
</table>
<input type="submit" value="Continue" />
</form>