Hi,

a component acquires a model from a CompoundPropertyModel only if you don't explicitly provide one.
Thus your example should work just fine:

PasswordTextField confirmPwdField = new PasswordTextField("confirmPassword", new Model<String>());

What do you mean by "it didn't work" ?

Sven

On 05/29/2011 11:16 AM, Mathilde Pellerin wrote:
Hi all,

I have a subcription form with a CompoundPropertyModel like this :
         Form<Membre>  inscriptionForm = new Form<Membre>("inscriptionForm",
                 new CompoundPropertyModel<Membre>(new
LoadableDetachableModel<Membre>() {

                     @Override
                     protected Membre load() {
                         return new Membre();
                     }
         }));

Membre is a POJO with these attributes :
     private String membreId;
     private Date dateNaissance;
     private Character sexe;
     private String password;
     private String email;
     private String codeIdentification;

But in my form, I want a confirm password field. It easy to add an
attributes to class Membre, but I think it doesn't make sense (Membre is
store in a database).
So I wonder if there is a way to have to models for one form?
I try that :
         PasswordTextField confirmPwdField = new
PasswordTextField("confirmPassword", new Model<String>());
         confirmPwdField.setRequired(true);
         confirmPwdField.setLabel(new Model<String>("Confirmation du Mot de
passe"));
         inscriptionForm.add(confirmPwdField);

but it didn't work.

And if it's not possible two have to models in one form, is there a way to
have a confirm password field without have a confirmPassword attribute in
class Membre?

Thanks
Mathilde




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to