You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jeff Schneller <je...@mootus.com> on 2012/07/13 04:36:51 UTC

ajax submit button that redirects to login before processing submit

I am trying to put a form on a page that can only be submitted if the user is logged in.  If the user is not logged in, I would like them to be able to submit the form but be redirected to the login page.  Then after successful login, the original form submission is processed. 

I am using 1.5.3 currently.

Here is what I was hoping would work but I keep getting the <ajax-response> sent to the browser instead of the submit continuing.

AjaxButton addButton = new AjaxButton("add") {


@Override

protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
if (!MySession.get().isAuthenticated()) {
throw new RestartResponseAtInterceptPageException(Login.class);
}

MyModel mm = (MyModel) form.getModelObject(); 
myService.addData(mm, MySession.get().getAccount());  //myService is a SpringBean
this.setResponsePage(getPage());  // reload the entire page for now
}
};
add(addButton);



Re: ajax submit button that redirects to login before processing submit

Posted by S B <si...@gmail.com>.
Hi Jeff, 

I'm experiencing a similar problem tring to redirect from my SignIn page
after I throw a RestartResponseAtInterceptPageException. 

Did you manage to find a solution or work around, if so could you explain
what it is, 

Cheers

Simon



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-submit-button-that-redirects-to-login-before-processing-submit-tp4650490p4652184.html
Sent from the Users forum mailing list archive at Nabble.com.

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