Unless you're a javascript guru or you like to write as short code as
possible you should not read all this. It's on the javascript code
I use in the form class. Every time I haven't looked on it for
a while I can't understand it myself anymore, that's why I've added an
example with comments.
The basic idea behind the javascript code is to work in an object oriented
fashion. This keeps the code short for many form elements and allows
us to reuse the code in an elegant way when we have several forms on one page.
Simple validation code without custom validators:
Complex validation code featuring custom validators:
var _dojs = new form("dojs", ["name_text", ["l", 1, 4, "length_e", "r", "[a-z]", "i", "valid_e"], "lr"],
[],
["callback"]);
|