You can pass PageReference to the page with the form and use it in
Form#onSubmit().

Page1.java:

setResponsePage(new FormPage(getPageReference()));

FormPage.java:

public FormPage(final PageReference pr) {

  add(new Form() {
    onSubmit() {
      setResponsePage(pr.getPage());
    }
  });
}



On Thu, Jan 19, 2012 at 2:39 AM, Chris Colman
<[email protected]>wrote:

> ** **
>
> I often use modal forms/dialogs so this issue is not a problem: In a modal
> scenario when the user submits a modal the page they called the modal form
> from is just sitting there behind the form when it closes – no need for
> redirection to the ‘calling page’ as it’s redundant.****
>
> ** **
>
> In scenarios where some customers prefer not to have modal forms the forms
> have to be pages in their own right and involve the ‘browser page change’
> dance.****
>
> ** **
>
> Is there a best practice in Wicket for making reusable page forms that
> remember which page called them and return to that page after submit or
> cancel? Or is there a Wicket class that manages this?****
>
> ** **
>
> Example scenario for  Reusable Address form****
>
> ** **
>
> Scenario 1****
>
> ** **
>
> Page A shows supplier’s data with a panel displaying their address which
> includes a ‘Change’ button.****
>
> ** **
>
> User clicks change and is taken to Address form page.****
>
> ** **
>
> User makes changes and hits ok. The browser returns to page A.****
>
> ** **
>
> Scenario 2****
>
> ** **
>
> Page B shows customer’s data with a panel display their address which
> includes a ‘Change’ button.****
>
> ** **
>
> User clicks change and is taken to Address form page.****
>
> ** **
>
> User makes changes and hits ok. The browser returns to page B.****
>
>  ****
>
> ** **
>
> Yours sincerely,****
>
> ** **
>
> Chris Colman****
>
>  ****
>
> Pagebloom Team Leader,****
>
> Step Ahead Software
>
> ****
>
> pagebloom - your business & your website growing together****
>
> ** **
>
> **Sydney**: (+61 2) 9656 1278     ****Canberra****: (+61 2) 6100 2120
> ****
>
> Email: [email protected] <//[email protected]>****
>
> Website:****
>
> http://www.pagebloom.com****
>
> http://develop.stepaheadsoftware.com****
>
>  ****
>
> ** **
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to