Yes, a different EM for each DDC option. Replacing the form's model is working. Replacing the form's modelObject worked before that. I'm just trying to understand what the best current practice is.
What would the advantage of fragments be? Creating the fragment on selection or maintaining N fragments? -troy On Tue, Aug 11, 2009 at 1:56 PM, bferr<[email protected]> wrote: > > It sounds like you have different entitiy models for each DDC option right? > That's why you are replacing the model of the form each time? > > I think you could try creating a fragment for each DDC option and each > fragment would have it's own model. Then replace the fragment inside the > form when the DDC is changed and the "enclosing CPM" would be the one on the > fragment and not the one on the form. > > > > > > > LazyBoy wrote: >> >> 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] >> >> >> > > -- > View this message in context: > http://www.nabble.com/Changing-a-Form%27s-Model-tp24883888p24922623.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
