On Wed, Feb 24, 2010 at 5:21 AM, Alexander Monakhov <[email protected]> wrote: > Hi, guys. > > I'm trying to create sing in page in modal window. So, there is home page > with sign in link. When user clicks the link modal window appears with > login/password form. When user submits valid authentication credentials > modal window is closed and sign in link is changed to sign out link. > > Here is some code snipets: > > Home page: > > public class HomePage extends WebPage { > > ..... > > public HomePage() { > .... > this.signInLink = new AjaxLink<Void>( SIGN_IN_LINK_ID ) { > > �...@override > public void onClick( AjaxRequestTarget target ) { > modal.show( target ); > } > > }; > this.signOutLink = new Link<Void>( SIGN_OUT_LINK_ID ) { > > �...@override > public void onClick() { > getSession().invalidate(); > > setResponsePage( BasePage.this ); > } > > }; > > signInLink.setOutputMarkupId( true ); > signOutLink.setOutputMarkupId( true ); > > if ( ((CustomSession) getSession()).isSignedIn() ) { > signInLink.setVisible( false ); > } else { > signOutLink.setVisible( false ); > } > > add( signInLink ); > add( signOutLink ); > > /* here goes modal window initialization*/ > } > > public void setSignedIn( > final boolean isSignedIn, final AjaxRequestTarget target > ) { > signInLink.setVisible( !isSignedIn ); > signOutLink.setVisible( isSignedIn ); > > target.addComponent( signInLink ); > target.addComponent( signOutLink ); > } > } > > > In modal window there are two inputs for login and password and ajax button. > When user pushes submit button. setSignedIn() method of HomePage is called > and modal window is closed. > > First problem is sign in link disappear when modal window is closed, but > sing out link doesn't appear (when I check ajax response, I can see that > component for sing out link was sent).
s/signInLink.setOutputMarkupId( true );/ signInLink.setOutputMarkupPlaceholderTag(true);/ > Second problem is firefox doesn't > save value of login/password as it does usually(I guess it's issue of modal > window. Also, if setPersisted() method is invoked for login field, there is > an item in cookie, but it doesn't appear in login field next time user goes > to login page.). i believe for this to work the input names must be stable, you can override getinputname() on the two formcomponents to return "username"/"password" instead of a dynamic name wicket generates. it is your job, then, to make sure other form components do not cause name collissions. > Third problem is if error() method is called, error message > doesn't appear in page, even though feedback panel is added( I was trying to > add feedback panel to home page or to panel that is added to modal window > without success. In any case in console WARN message appeared.) your ajaxbutton has an onerror(), in there add the feedbackpanel to the ajax target. also make sure you call setoutputmarkupplaceholdertag(true) on the panel after you created it. -igor > > Could you give me any suggestions? > > Best regards, Alexander. > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
