MyFaces Client Side Validations
February 7, 2007
It’s been almost a month since I’ve started working on a Client Side Conversion&Validation add-on for MyFaces and although %50 of the work is done, I’m glad that it has now reached a presentable point:) At past I’ve created a client side validation library which is in jsf-comp now and another one for my old firm and yet another experiment for myfaces, the whole story is here. Although all of these works are dead now, they were great experiences for my final work.
Anyway long story short, the demos showing the Client Side Validation in MyFaces is deployed within Sandbox Examples that can be reached at IRIAN‘s website. There are three examples under Client Validation section, one uses jsf standard h:form, another one uses sandbox s:fom and the last shows s:validationScript component.
The idea of having a validationScript tag is to enable this feature even myfaces form is not used. So if you’re using some other form like Trinidad tr:form or your own custom form, including validationscript component will enable client validation in the page. I suggest using h:form or s:form since it makes things easier by doing the dirty stuff(See the page source differences between the two examples).
There were a couple of client side validation solutions before like my old jsf-comp lib, shale or adf. Well, I dont really fancy Shale at all, because it uses alerts and a page designer needs to add several tags to validate at client side. In MyFaces you don’t need to do these, just turn on/off the following context param.
Also it’s easy to plugin your own custom validator/converter, just make it implement ClientConverter/ClientValidator, provide your custom js resource and it’s all set. I’ll post an example later. I have many new ideas to implement like optional alerts, partial validation but the core infrastructure is completed and other than a few refactorings a big change is not likely to happen.