JSF Client Side Validators v0.9.1 and Facelets
Posted by cagataycivici on June 2, 2006
This version is focused entirely on bug fixes. Unfortunately I could not get the enough free time to add new features and tried to fix the reported bugs instead. Here is the changelog of version 0.9.1.
- An empty popup was displayed even the input was valid. Fixed.
- Multi access to global javascript variables was subject to fail. These are converted to local ones.
- A state saving bug regarding the display mode is fixed.
- Resource loading is done via the *.jsf mapping instead of /faces/*.
- Regular expression validator now considers empty input as valid.
- Instead of document.all, w3c standart document.getElementById is used.
- Improved example web application demonstrating both validation summary both with and without a popup.
Also if you are a Facelets user, I’ve provided the facelets taglib file as the following;
| <?xml version=”1.0″?> <!DOCTYPE facelet-taglib PUBLIC “-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN” “facelet-taglib_1_0.dtd”> <facelet-taglib> <namespace>http://sourceforge.net/projects/jsf-comp/clientvalidators</namespace> <tag> <tag-name>requiredFieldValidator</tag-name> <component> <component-type>net.sf.jsfcomp.clientvalidators.requiredfieldvalidator</component-type> </component> </tag> <tag> <tag> <tag> <tag> <tag> <tag> <tag> |
More information on JSF Client Side Validation Library is here. So what is next, I have many other new features in my mind like running the validations onblur-onkeypress other than onsubmit, improving the compare validator(add more operators) and etc. I am currently working on MyFaces Client Side Validation support for tomahawk validators and dont know when I will implement the features I’ve mentioned. Also Acegi’s 1.0.0 version is released and I feel like the time to improve the Acegi-JSF components is near. Moreover someone asked me when the new version of JSF Chart Creator is coming, I had also many ideas on the new version just have not enough time. All of these mean to me just one thing; More nights without sleep, in the end that is the discipline of a “NIGHT DEVELOPER“.

June 2, 2006 at 12:39 pm
Hi Cagatay,
don’t know if I am misunderstanding something, but I thought that one does not use the class name in the facelets taglib file. If I use the file above the following error occurs: Undefined component type net.sf.jsfcomp.clientvalidators.rangevalidator.RangeValidator.
Working taglib file example:
Where net.sf.jsfcomp.clientvalidators.requiredfieldvalidator comes from faces-config.xml:
net.sf.jsfcomp.clientvalidators.rangevalidator.RangeValidator
June 2, 2006 at 12:42 pm
Correction: net.sf.jsfcomp.clientvalidators.requiredfieldvalidator comes from faces-config.xml:
net.sf.jsfcomp.clientvalidators.requiredfieldvalidator
net.sf.jsfcomp.clientvalidators.requiredfieldvalidator.RequiredFieldValidator
June 2, 2006 at 2:07 pm
Ooops, my bad. I’ve fixed the taglib file now. Thanks for warning me Michael.
June 5, 2006 at 12:47 pm
Hi all!
I need your help, bacause I’ve just have a problem when using several forms in the same page (f.e. add and edit form). The problem is that I’m not able to validate these forms separately.
Any idea about how to do this.
Thanks.
June 5, 2006 at 1:55 pm
Hi Pakin, I guess the problem is that generated function’s name is same for all the forms although scriptgenerator takes the server id of the form to be generated. The upcoming release will fix this issue.
June 5, 2006 at 2:37 pm
That is!
It’s exactly what you say, so…when did you say the next version is going to be released?
I told you because for me this bug means getting in troubles.
Any quickly warkaround? Any suggestion?
Thanks and regards.
June 5, 2006 at 4:26 pm
I guess the solution is trivial, instead of writing the function name as clientValidate, the name should be clientValidate_form1 where the prefix is the form to be validated and on form’s submit or button’s onclick the user must change return clientValidate to returnClientValidate_form1. I’ll fix this issue tonight hopefully, and make a new release 0.9.2.
June 5, 2006 at 6:11 pm
If you don’t have enough time I’ll try to send you the code that implements your solution today and you can modify it and package the new version when you want or can
Send me an email with yours to send the code.
June 5, 2006 at 6:40 pm
Certainly the solution is very trivial, so I think that you don’t need my code
unless you want to implement a solution more sofisticated.
Anyway, I think you should publish a new release with this issue fixed as soon as possible.
REgards and thanks a lot.
June 8, 2006 at 5:39 am
Hi there
I am a proud user of your jsf-client side validation components and I am very much impressed. Good job!
One question though:- Is there any way of changing the “yellow” background color that appears on validation errors to something else?
Ideally the lines below need to change the stylesheet class of the element instead of changing the background color.
function highlightField(obj) {
if(document.getElementById(obj) != null)
document.getElementById(obj).style.backgroundColor=”yellow”;
}
function resetFieldColor(obj) {
if(document.getElementById(obj) != null)
document.getElementById(obj).style.backgroundColor=”white”;
}
Also on the same note,
I would like to see the following styles moved to a seperate css file (that the user can override if need be) instead of embedding them into every single page.
Regards
June 8, 2006 at 8:30 am
Thanks Pari, Yes there is still a lot todo, and the things you mentioned are already on my todo list.
June 13, 2006 at 8:04 pm
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??
August 30, 2006 at 8:51 pm
Sr. Cagatay
The display tag is intended to not display error messages on reserved fields, but only in sumary. In my code it does´nt work. Here is the code:
It looks to do exactly the oposite: appear on reserved field but not on summary.
Some idea?
Tks
November 3, 2006 at 3:59 pm
Ok, I’m stuck.
I’ve done everything at
http://jsf-comp.sourceforge.net/components/clientvalidators/index.html
except where it has
< %@ taglib uri="http://sourceforge.net/projects/jsf-comp/clientvalidators" prefix="cv"%>
I’ve put
xmlns:cv=”http://sourceforge.net/projects/jsf-comp/clientvalidators”
in with my other namespace bits, because I’m using Facelets, not JSP.
So the clientvalidators-0.9.1.jar is in my webapp/appname/WEB-INF/lib/ directory
It says this, when I deploy my war:
Nov 3, 2006 1:42:41 PM com.sun.faces.config.rules.ComponentRule end
WARNING: [ComponentRule]{faces-config/component} Merge(net.sf.jsfcomp.clientvalidators.requiredfieldvalidator)
Nov 3, 2006 1:42:41 PM com.sun.faces.config.rules.ComponentRule end
WARNING: [ComponentRule]{faces-config/component} Merge(net.sf.jsfcomp.clientvalidators.requiredfieldvalidator)
But then, I load my page which has this defined in it:
and there’s no javascript in the page to do anything.
I’ve downloaded the sample-webapp, and that works. I don’t seem to be able to crib from it, though, because it’s using JSPs and I’m not.
I’d be grateful for any help anyone can give.
Cheers,
November 3, 2006 at 5:30 pm
Replying to myself; I found a different entry about this (telling Google not to omit similar results was the key):
http://www.jroller.com/page/cagataycivici?entry=jsf_client_side_validators
the comments helped me out, and Stuff Now Happens for me.
Cheers,
November 17, 2006 at 1:03 pm
Hi: civici
at the Validator web site :
http://jsf-comp.sourceforge.net/components/clientvalidators/index.html
about how to use CV.
you say :
——————————————–
Prefix Mapping
Resources are loaded from the distribution jar using the default /faces/* prefix, make sure this mapping is defined in web.xml.
——————————
but , now i find the .js resources do not load through the /faces/* mapping.
you use .jsf mapping loading the resources.
the CV generate the following js code.
…./validatorResource.jsf?name=clientvalidators&type=js
so, now we must using .jsf mapping . do not need using /faces/* mapping .
also , if we use .faces mapping . we must add .jsf mapping for using CV.
YOU can fix this bug. using /Faces/* mapping to load resources , no using .jsf or .faces mapping .
December 11, 2006 at 1:56 pm
i have integrated a validator in my jsf page like this:
. where the page is loaded it return the HTTP 500 error page and in my console i have this error message:”javax.faces.FacesException: Could not get property errorMessage of component _idJsp20″. i think i maked all indications mentioned in the documentation of clientvalidators-0.9.1.jar.
do you have an idea? thanks
July 3, 2007 at 11:48 pm
I am also getting the same error as “Reda” above. I am using MyFaces 1.1.5, Tiles and Tomahawak 1.1.5. If I remove only the below line from my code:
then the error goes away but no validations obviously. Any idea? Thanks.
July 3, 2007 at 11:49 pm
The code was missing from my post above.
March 6, 2008 at 8:58 am
How to Create a Pop up Message Dialog Box using JSF.. Is there any to do this.. ????????