wForms Extension Overview
This post is part of the wForms Documentation.
For additional help, visit the wForms forum.
wForms is a javascript extension that adds commonly needed behaviors to traditional web forms. It follows the principle of progressive enhancement : unobtrusive, cross-browser and degradable. I should also point out that not a single line of code is required to actually use it. That makes the learning curve almost non-existant. If you can add a class to a tag, then you can use wForms.
Implemented behaviors are:
* Switch: Allows you to show/hide relevant parts of a form based on the user inputs.
* Repeat: Allows parts of a form to be repeated if the user wants to provide more answers.
* Field Hint: Displays contextual help based on the current input focus.
* Input Validation: Validates common input types (email, numbers, ..) and displays appropriate error messages.
wForms is not as complete or ambitious as XForms or Web Forms 2.0 are, but at least it works with today’s browsers and is web standards compliant.
Update: Comments are now closed for this post, but you can go to the wForms forum if you have any question or comment. Thanks !
June 30th, 2005 at 5:16 pm
I really like what you have done but I seem to have an issue with the behaviour of the library when it is use with large listboxes. I have a drop down then has over 900 options.
Internet explorer takes over 30 seconds to load while the wforms scans all of the the options. Is there any way to disable this behaviour for listboxes?
June 30th, 2005 at 8:51 pm
900 options !! Well, first I wonder if a drop-down list is really the right tool for the job, but in any case you can create a customize.js script, linked just after wforms.js (see How To Customize wForms).
customize.js should contain:
wUTILITY.prototype.getElements = function(n, list) {
if(!list) list = new Array();
if(n.nodeType==1 && n.tagName.toUpperCase()!="SELECT") {
list[list.length]= n;
for(var i=0; i<n.childNodes.length;i++)
this.getElements(n.childNodes[i], list);
return list;
}
}
Note: ‘ && n.tagName.toUpperCase()!=”OPTIONS” ‘ was added to the original code
I have not tested this, but it should work. It effectively leaves out all ’select’ fields from the processing. Of course, you won’t be able to use any of the wForms behaviors on those fields anymore.