Dear all,
first of all, thank you very much for this library, I have learnt
more javascript from it than from any book.
I have been using a customized version of the library for a while, in
prototype projects, and I am attempting to push it (or something like
it) as a shared component across our projects.
Now, I deal with enterprise web-fronted back-office applications.
This means that I cannot rely on client side validation alone.
However, server side engines such as ASP and JSP are quite happy
running javascript, which makes me think that I should be able to
refactore the validation library to seperate the validation rules
from the 'behaviour' rules, and use the same library client and
server side.
I have no exact design yet, but I am thinking of something along the
lines of :
<ServerSide>
validator.addField("field1","clientField1", ZIP_CODE)
...
//generate clientside script block
validator.getclientscriptFor("field1");
....
on_post()
{
validator.validate("field1", query.getField("clientField1"));
....
}
</ServerSide>
Very poor example, but the gist of it is :
1) define all validation rules in the server script.
2) generate the client side validation code out of the validation
rules, instead of re-coding them.
3) run validation on server side as well.
Now, I'd love to know if any of you can see a big flaw in what I am
attempting, or if you have any usefull idea I could follow?
Once I am done, if I am any succesfull, I'll feed back my code to
this site.
Regards