Furasta.Org – Form Validation
Posted Aug 21st, 2010 by Conor in in Furasta.OrgForm validation is quite easy in Furasta.Org. Let’s look at an example form:
<form method="post" id="Information-Form"> Name: <input type="text" name="Name"/> Email: <input type="text" name="Email"/> Password: <input type="password" name="Password"/> Repeat Password: <input type="password" name="Repeat-Password"/> <input type="submit" name="Information-Form-Submit"/> </form>
Furasta.Org provides a built-in function to validate forms, such as the above one, in both PHP and JavaScript. To validate the form simply create an array of rules:
$rules=array( 'Name'=>array( 'required'=>true ), 'Email'=>array( 'required'=>true, 'email'=>true ), 'Password'=>array( 'required'=>true, 'minlength'=>6, 'match'=>'Repeat-Password' ), 'Repeat-Password'=>array( 'required'=>true, ) );
Then call the validate function and pass the rules, a selector for the form and the name of the form submit like so:
validate($rules,"#Information-Form",'Information-Form-Submit');
That’s it. Form validation complete in PHP and JavaScript. Easy.

