JSF Client Side Validators RELOADED

They’ve existed once, donated to myFaces and suddenly disappeared… Now JSF Client Side Validators are back to the city 🙂 Well here’s what really happened. Actually me and Martin decided that it would be better provide similar client side validation support for the extended validators in tomahawk. So instead of using seperate client side validators, the ones already in the tomahawk will have enableClientScript flag which will enable them to validate at client side. I’m currently working on it; on my way since these seperate client validators once created have not been released so far, I’ve decided to release them at jsf-comp. Before doing the release I’ve added many features to the client validation library. Here are the currently supported validators.

1) Required Field Validator
2) Range Validator
3) Compare Validator
4) Regular Expression Validator
5) Length Validator
6) Integer Only Validator
7) Custom Validator
8) Validation Summary

And two views showing the client validation framework in action, one without popup and one with.

Free Image Hosting at www.ImageShack.us   Free Image Hosting at www.ImageShack.us

Key Features
1) Client Validation in JSF is also supported by Shale and ADF Faces however both use unattractive popups to display the validation messages. By default client Validators show the validation message where they are placed. However this is not mandatory, popups are also supported with an optional boolean attribute.
2) Client validators are extendable via the Custom Validator component, you can plug your own validator functions to this component.
3) Error messages are fully customizable, each validator can user their own message or read from a bundle.
4) Style of the validation messages can be managed through the style attribute.
5)
Resource loading is done from the jar file so there is no need to use additional resources like js files, only thing you need is the jar file.
6)
Validation Summary component allows the presentation of each validation message in one place.
7)
Display mode is customizable which means space for messages can be reserved or created dynamically, also if set to none then the message is only displayed at validation summary.
8)
Highlighting is supported, if set true then the components caused the validation is highlighted with color.
9)
Implementation independency, client validators can be plugged to any JSF implementation.

UPDATE: 11.02.2007
The project is no longer under development but the successor of this library has joined Apache MyFaces.

Detailed Documentation and Download
*
There is a very detailed documentation at jsf-comp.
*
Both source and the distribution can be reached at jsf-comp downloads section.
*
I’ve provided an example web application which can also be reached at downloads section.
*
In addition I’ve updated my first entry on the client validators.

13 Responses to JSF Client Side Validators RELOADED

  1. This looks really good.

    The trick is to keep up with all of the good stuff comming from the JSF community.

    I guess the Hani boycott never took hold.

  2. Pakin says:

    First of all, thank you for your work.

    Now I would like to ask you what are the main advantages or differences between using your package or using the Shale client validator that I’m currently using.

    Thanks a lot.

  3. Pakin says:

    Forget it.

    I’ve already read it in the key features section of your post.

    Sorry 🙂

  4. Cagatay says:

    Hani who? 🙂

  5. pakin says:

    Hi Cagatay!

    I’ve just sent some features request and a bug with its solution for this component at the jsf-comp location in sourceforge.

    Thanks.

    Regards

  6. Cagatay says:

    Hi Pakin, thanks for all.

  7. Michael says:

    Hi,

    looks great. One question:
    How can it be used with Facelets?

    Thanks for any help.

  8. Cagatay says:

    Yes, of course, only thing needed is the facelets taglib. There is none created, but I’ll create one soon and post here.

  9. Dave says:

    Hi All.

    I’m not intentionally trying to post twice, but I originally posted this in the “Facelet” part by mistake.

    Trying to use validator in a tab inside page fragment.
    Trying to use popup for validation messages.
    I think the problem I am having is identifying the “form” property properly.

    Here is the heirarchy:

    Form
    ui:form binding=”#{EnrollStaffMain.form1}” id=”form1″

    Page Fragment inside Div

    Sub View inside page fragment

    TabSet
    ui:tabSet binding=”#{StaffTabPanel.tabSet1}” id=”tabSet1″

    Tab
    ui:tab action=”#{StaffTabPanel.tab1_action}” binding=”#{StaffTabPanel.tab1}” id=”tab1″

    For something like this, what would the form=”…” parameter look like for the popup??

    Thanks

  10. madhav says:

    The problem that is not solved by most of the client side validation frameworks/components is partial form validation. It is the same thing with the set of components that you have developed.

    I tried using sandbox subForm along with your components but i guess subForm is only meant to be used for server side validations.

    Can you suggest a way in which partial form validations can be achieved?

    Thanks,
    Madhav

  11. Pai says:

    Hi,

    I am new to JSF and happen to use the client side validator. It is excellent stuff. But I am getting a strange problem when using the validator. ( i am using cv:lengthValidator for checking the length). When the page is submitted, user (since i am the only user now user is me)gets a feel that the page first moves down to accomodate the summary (this is included at the top of the page) and suddenly the page moves up(incase there is no error). If there is error the page displays perfectly.(no problem with my eye in this case). Can you please suggest how to remove this page moving down and up problem.

  12. samir says:

    I want to access every attribute of component by using client validations.Is it possible?