ProtoForm version 2.0 is a Prototype.js based plugin that allows you to very easily validate the forms fields and send data in ajax: you can view the source code here.
ProtoformClass utilise the field elements id attribute to indicate the validation requirements (through suffixes).
The title attribute of the form fields (to be valitated) is used to show an error message; assign an id to each of these fields with your prefix and the type of validation desired.
If You want, customize form stylesheets, loading, errors and response message (div.protoform-message ul.error, p.working, inserted by the script).
Event.observe(window,"load",function() {
new Protoform('myform', { ajax:false });
$$("form.myotherforms").each(function(forms){
new Protoform(forms);
});
});
ajax: enable or disable submit in ajax (default 'true').
// some suffix examples <input type="text" id="name_Req" name="name" title="Required! enter your name" /> <input type="text" id="contact_Req_Email" name="email" title="Required! enter a valid email address" /> <input type="text" id="phone_Tel" name="phone" title="Enter a valid phone number" /> <input type="text" id="date_Date" name="date" title="Enter a valid date" />
Get ProtoForm V 2.0 (23/01/2011) - the package contains an working example and Prototype 1.7 framework.
ProtoForm is licensed under the MIT license.
You can post your comments, suggestions or bug reports on my blog CSSRevolt: i will be happy to receive your feedback, help me to do better plugin!