just use an AjaxButton François
Le 25 mai 2011 à 13:57, Mathilde Pellerin a écrit : > Thanks for answer. > > Sorry for the first question : it was not the main problem so I didn't > search the solution. Now it's fine, the confirmation message disappear. > > But the main problem was the second : how can I prevent the modal to > disappear when login failed? > > I tried to use ajaxButton instead submit button but then I can't I use the > model of my form like I did with submit button. > > Any advice would be great... > > this is my actual code (with submit button, no ajax) : > > public class ConnexionContentPanel extends FeedbackPanel { > private static final long serialVersionUID = 6952274296991345904L; > > @SpringBean > private ServiceIdentification serviceIdentif; > > @SuppressWarnings("serial") > public ConnexionContentPanel(String id) { > super(id); > > Form<Membre> loginForm = new Form<Membre>("loginForm", > new CompoundPropertyModel<Membre>(new > LoadableDetachableModel<Membre>() { > > @Override > protected Membre load() { > return new Membre(); > } > })) { > > @Override > protected void onSubmit() { > Membre membre; > > membre = serviceIdentif.identifier(getModelObject().getId(), > getModelObject().getPassword()); > if(membre == null) > error("Identifiant ou mot de passe incorrect"); > else > System.out.println("Connexion"); > > } > }; > > loginForm.add(new TextField<Membre>("membreId")); > loginForm.add(new PasswordTextField("password")); > > add(loginForm); > } > } > > > 2011/5/25 Martin Grigorov <mgrigo...@apache.org> > >> Translate the message to English and search in Nabble/Google. >> It has been discussed many times. >> >> On Wed, May 25, 2011 at 12:46 PM, Mathilde Pellerin < >> mathilde.pelle...@gmail.com> wrote: >> >>> Hi all, >>> >>> I have a login form in a modal window. >>> I want that an error message appears when login fail, so my panel extends >>> FeedBackPanel. >>> But when I submit the form, an confirmation message appears with this >>> message : >>> "Voulez-vous vraiment quitter cette page ? >>> Reloading this page will cause the modal window to disappear. >>> Appuyer sur OK pour continuer, ou Annuler pour rester sur la page >>> actuelle." >>> >>> and if I click on OK, the modal window disappear even if login failed. >>> >>> this is my code : >>> public ConnexionContentPanel(String id) { >>> super(id); >>> >>> Form<Membre> loginForm = new Form<Membre>("loginForm", >>> new CompoundPropertyModel<Membre>(new >>> LoadableDetachableModel<Membre>() { >>> >>> @Override >>> protected Membre load() { >>> return new Membre(); >>> } >>> })) { >>> >>> @Override >>> protected void onSubmit() { >>> Membre membre; >>> >>> try { >>> membre = >>> serviceIdentif.identifier(getModelObject().getId(), >>> getModelObject().getPassword()); >>> if(membre == null) >>> error("Identifiant ou mot de passe incorrect"); >>> else >>> System.out.println("Connexion"); >>> } catch (Exception e) { >>> e.printStackTrace(); >>> } >>> >>> } >>> }; >>> loginForm.add(new TextField<Membre>("membreId")); >>> loginForm.add(new PasswordTextField("password")); >>> >>> add(loginForm); >>> } >>> >>> how can I avoid the confirmation message, and how can I prevent the modal >>> to >>> disappear whan login failed? >>> >>> thanks. >>> >>> Mathilde >>> >>> -- >>> 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> >>> >> >> >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com <http://jweekend.com/> >> > > > > -- > 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> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org