-
1. Re: Compare Passwords
Ilya Shaikovsky Sep 22, 2009 7:33 AM (in response to Janosch Rohdewald)ajaxSingle=true means that only parent input will be processed. so remove it or just add process="password"
-
2. Re: Compare Passwords
Janosch Rohdewald Sep 22, 2009 7:57 AM (in response to Janosch Rohdewald)Hi
If I remove ajaxSingle="true", then all other fields in the form must be validated as "ok" to run the action.
But process="password" works! Great!
Meanwhile I looked at a4j:beanValidator. With this one I have the same problem. Do you have also such a good solution?
Thanks and regards
Joschi03 -
3. Re: Compare Passwords
Ilya Shaikovsky Sep 22, 2009 8:37 AM (in response to Janosch Rohdewald)
Meanwhile I looked at a4j:beanValidator. With this one I have the same problem.
add details. -
4. Re: Compare Passwords
Janosch Rohdewald Sep 22, 2009 8:47 AM (in response to Janosch Rohdewald)Hi
<h:outputLabel value="#{msg.password}" /> <h:inputText id="password" value="#{registerUser.password}"> <r:beanValidator /> </h:inputText> <r:message for="password" /> <h:outputLabel value="#{msg.password_confirm}" /> <h:inputText id="password_confirm" value="#{registerUser.passwordConfirm}" validator="#{registerUser.checkPasswords}"> <r:beanValidator /> </h:inputText> <r:message for="password_confirm" />
Then, the funcion is as follows:public void checkPasswords(FacesContext facesContext, UIComponent component, Object value) {...}
In the field 'value' the value of 'passwordConfirm' is saved, but I cannot access to 'password' to compare them.
Thanks and regards
Joschi03 -
5. Re: Compare Passwords
Janosch Rohdewald Sep 23, 2009 1:48 AM (in response to Janosch Rohdewald)Hi
Does really no one know how to do this?
Thanks
joschi03 -
6. Re: Compare Passwords
Janosch Rohdewald Sep 23, 2009 10:43 AM (in response to Janosch Rohdewald)Or is there another way, that it seems for the user that the passwords are compared, when he clicks on the register button?
Thanks for helping
Joschi03 -
-
8. Re: Compare Passwords
Janosch Rohdewald Sep 24, 2009 5:52 AM (in response to Janosch Rohdewald)Hi
now I tried it with the graphValidator:<a:form id="registerForm" enctype="multipart/form-data"> <r:graphValidator> <h:panelGrid columns="3"> <h:outputLabel value="#{msg.password}" /> <h:inputText id="password" value="#{registerUser.password}" /> <r:message for="password" /> <h:outputLabel value="#{msg.password_confirm}" /> <h:inputText id="password_confirm" value="#{registerUser.passwordConfirm}" validator="#{registerUser.checkPasswords}" /> <r:message for="password_confirm" /> <a:commandButton value="#{msg.register}" actionListener="#{registerUser.register}" reRender="name" /> </h:panelGrid> </r:graphValidator> </a:form>
In checkPasswords(), the variable password is empty. And register() is not even called. But I also get no error...
Thanks
Joschi03 -
9. Re: Compare Passwords
Janosch Rohdewald Sep 24, 2009 2:26 PM (in response to Janosch Rohdewald)Or does any other way exists, that I can validate all inputs together and compare the password also at the same time. I want stay using hibernate validator for the other inputs. I can also not use immediate=true and/or bypassUpdates=true. The action of the commandButton
will be executed, but the other inputs are not validated and updated in the model.
Thanks
joschi03 -
10. Re: Compare Passwords
Alexander Smirnov Sep 30, 2009 8:48 PM (in response to Janosch Rohdewald)Validating multiply fields in the JSF a little bit tricky.
You got 'null' value for password as null, because you use 'avaxSingle' attribute ( ajaxValidator implicitly set it to 'true'), so no other components are processed by AJAX request and their values does not updated. You have to include both fields into request processing by 'process' attribute or put both fields into one 'a4j:region' component.
To multy-fields validation, take a look for beanValidator example that does exactly what you want. You can find its source in the samples/beanValidator forlder from RichFaces source distribution. -
11. Re: Compare Passwords
Alexander Smirnov Oct 1, 2009 11:29 AM (in response to Janosch Rohdewald)The graphValidator example at http://livedemo.exadel.com/richfaces-validator/pages/graphValidation.jsf validates total value of three bean properties, that is very close to your needs.
To limit validation for password fields only, you can putt them into <a4j:region> component.