Form id is corret, but remember that form and feedback panel are not added directly to modal window. They are inside ConnexionContentPanel which in turn is added to modalwindow. In your test you should be able to access form calling getContent() before get("loginForm"), i.e:

modalWindow.getContent().get("loginForm")


this is the code to construct modal window
         final ModalWindowE4N modalConnexion = new
ModalWindowE4N("modalConnexion");
         modalConnexion.setTitle("Connexion à l'espace membre");
         modalConnexion.setContent(new
ConnexionContentPanel(modalConnexion.getContentId()));
         add(modalConnexion);

Form is added in ConnexionContentPanel :
public ConnexionContentPanel(String id) {
         super(id);

         //Création du formulaire dont les champs seront liés aux champs d'un
membre grace au model
         Form<Membre>  loginForm = new Form<Membre>("loginForm",
                 new CompoundPropertyModel<Membre>(new
LoadableDetachableModel<Membre>() {

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

         //Création et ajout des champs id et pwd au formulaire
         TextField<Membre>  idField = new TextField<Membre>("membreId");
         idField.setRequired(true);
         loginForm.add(idField);

         PasswordTextField pwdField = new PasswordTextField("password");
         pwdField.setRequired(true);
         loginForm.add(pwdField);

         //Ajout d'un du feedback panel qui contiendra les erreurs relevées
par le formulaire
         final FeedbackPanel feedBackPanel = new FeedbackPanel("errorMsg");
         feedBackPanel.setOutputMarkupId(true);
         add(feedBackPanel);

         //création du bouton ajax pour soumettre le formulaire
         AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {

             @Override
             protected void onSubmit(AjaxRequestTarget target, Form<?>  form)
{
                 Membre modelObject = (Membre) form.getModelObject();
                 Membre membre;

                 membre = serviceIdentif.identifier(modelObject.getId(),
modelObject.getPassword());
                 if(membre == null)
                     error("Identifiant ou mot de passe incorrect");
                 else
                     setResponsePage(TableauBordPage.class);
             }

             @Override
             protected void onError(AjaxRequestTarget target, Form<?>  form) {
                 target.addComponent(feedBackPanel);
             }
         };
         loginForm.add(submitbutton);

         //ajout du formulaire au panel
         add(loginForm);
     }

you can see that form id is correct.
It is the same problem with FeedBackPanel errorMsg : I get a null pointer
when I try to get it with modalWindow.get("errorMsg");




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

Reply via email to