since you probably don't want to show the login form after a successful
login,
you could replace the login panel with the logout panel (and vice versa)
this could look something like the following:

// constructor of class LoginPanel
public LoginPanel(final String id) {
       super(id);
       this.setOutputMarkupId(true);
       Form form = new Form("form");
       form.add(new AjaxSubmitButton("login", form) {
           protected void onSubmit(AjaxRequestTarget target, Form form) {
               Panel panel = new LogoutPanel(id);
               panel.setOutputMarkupId(true);
               LoginPanel.this.replaceWith(panel);
               target.addComponent(panel);
           }
       }.setOutputMarkupId(true));
       add(form);
   }

any comment on this approach?


On 5/4/07, Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]>
wrote:

Hello, I have two panels, one that is mostly a form for login (user/pass
+button) and the other panel is just a link (onClick==>logou).

Now I changed the button for the login form to an ajax button. Everythig
works fine.

The thing is that I had a code something like this in the logout panel.



@Override
public boolean isVisible(){
    return getMyWicketSession().isUserLoggedIn();
}

this code made every round trip evaluate whether the user was still logged
in and if so then render the appropriate option to logout.

how could I add to the target, the logout panel, do I need to pass it
through the constructor :


private final logoutPanel;
public LoginPanel(String id, LogoutPanel panel){
   logoutPanel = panel;

}

Ajax....onSubmit(target.......{
    target.add(logoutPanel)
}
??

Or could I just set in the constructor of the LogoutPanel
setOutputMarkupId(true) and then call on it from the onSubmit AJAX button?

I am a bit lost on this. Or could I just add a simple JavaScript "
document.getElementById('logoutPanel').style.visibility = "visible";

f(t)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to