Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
6.5.0, 6.10.0
-
None
-
None
-
Windows 7 + Chrome
Description
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>