I have the following password confirmation pattern borrowed from WIA

                PasswordTextField p1 = new
PasswordTextField("password").setResetPassword(false);
                docForm.add(p1);
                PasswordTextField p2 = new
PasswordTextField("repeatPassword").setResetPassword(false);
      -->      p2.setModel(p1.getModel());
                docForm.add(p2);
                docForm.add(new EqualPasswordInputValidator(p1, p2));

in a form that gets reused (repetitively in the same page).  This used
to work fine
with a CPM and calling docForm.setModelObject().

I rewrote to pass models instead of objects, changing
    docForm.setModelObject() to
    docForm.setModel(new CPM(new EntityModel(...)))

and got
    "No get method defined for class: ... expression: repeatPassword"
But the other fields work fine, if I comment out the repeatPasswordField.
(My underlying data object has never had a repeatPassword field.)

It works if I call
     cpm.setChainedModel(new EntityModel(....));

instead, but that seems a little non-obvious.  I imagine redoing the
p2.setModel(p1.getModel() would work too.

Q1.  Is the setChainedModel() call the best solution for this case?
Q2.  It's a good thing to pass models, right?  LDM's don't support setObject().
Q3.  In general (not this case), for reusing forms with CPM(EntityM) should I
        replace the CPM or only the EntityM ?

Thanks,
-troy

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to