I didn't find getContent() method to modalWindow component, but it works
well in two steps :
ConnexionContentPanel loginPanel = (ConnexionContentPanel)
modalWindow.get(modalWindow.getContentId());
Form<?> loginForm = (Form<?>) loginPanel.get("loginForm");

thanks a lot !

2011/5/26 Andrea Del Bene <adelb...@ciseonweb.it>

> 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
>
>


-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
<http://www.mathilde-pellerin.fr/> http://www.mathilde-pellerin.fr/    Mes
liens :  <http://www.viadeo.com/fr/profile/mathilde.pellerin>
<http://fr.linkedin.com/in/mathildepellerin>

Reply via email to