You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Betlista (JIRA)" <ji...@apache.org> on 2013/08/30 10:39:51 UTC
[jira] [Commented] (WICKET-5336) Strange behavior of
EqualPasswordInputValidator
[ https://issues.apache.org/jira/browse/WICKET-5336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13754500#comment-13754500 ]
Betlista commented on WICKET-5336:
----------------------------------
Sven, thanks for clarification I missed that in validator's hierarchy.
Just note for others:
I prefer the following code to achieve the goal
@Override
protected void onInitialize() {
pass.getForm().add(new EqualPasswordInputValidator(pass, cpass));
super.onInitialize();
}
> Strange behavior of EqualPasswordInputValidator
> -----------------------------------------------
>
> Key: WICKET-5336
> URL: https://issues.apache.org/jira/browse/WICKET-5336
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 6.5.0, 6.10.0
> Environment: Windows 7 + Chrome
> Reporter: Betlista
> Assignee: Sven Meier
> Labels: validation
>
> I have page and panel in it. Panel contains two password fields passwd and cpasswd. I added EqualPasswordInputValidator to panel, but it's not working when it's not added to form. When validator (behavior) is added to component itself, it's not working too...
> In general I do not want to perform form lookup or passing form as parameter to all panels...
> Page code:
> public class PasswdValidatorTestPage extends WebPage {
> public PasswdValidatorTestPage() {
> super();
> add(new FeedbackPanel("feedback"));
> final Form<FormObject> form = new Form<FormObject>("form", new CompoundPropertyModel<FormObject>(
> new FormObject()));
> form.add(new PassPanel("passPanel", form));
> add(form);
> }
> class FormObject implements Serializable {
> String passwd;
> String cpasswd;
> }
> }
> Page markup:
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>Insert title here</title>
> </head>
> <body>
> <div wicket:id="feedback" />
> <form wicket:id="form">
> <div wicket:id="passPanel" />
> <input type="submit" />
> </form>
> </body>
> </html>
> Panel class:
> public class PassPanel extends Panel {
> public PassPanel(final String id, final Form<FormObject> form) {
> super(id);
> final PasswordTextField pass = new PasswordTextField("passwd");
> pass.setResetPassword(false);
> add(pass);
> final PasswordTextField cpass = new PasswordTextField("cpasswd");
> cpass.setResetPassword(false);
> add(cpass);
> add(new EqualPasswordInputValidator(pass, cpass)); // NOT WORKING
> //pass.add(new EqualPasswordInputValidator(pass, cpass)); // NOT WORKING
> //cpass.add(new EqualPasswordInputValidator(pass, cpass)); // NOT WORKING
> //form.add(new EqualPasswordInputValidator(pass, cpass)); // WORKING
> }
> }
> Panel markup:
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>Insert title here</title>
> </head>
> <body>
>
> <wicket:panel>
> Password: <input wicket:id="passwd" type="password" /><br />
> Confirm Password: <input wicket:id="cpasswd" type="password" />
> </wicket:panel>
> </body>
> </html>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira