class SearchPanel ... {
  ...
  add("id", new SomeButtonSubmitLinkOrForm {
        @Override
      public void onSubmit() {
         // your biz logic
         PageParameter pageParameter = new PageParameters();
         pageParameters.add("searchFilter", mySearchFilter);
         setResponsePage(SearchResultsPage.class, pageParameter);
      }
  });
  ...
}
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/request/m
apper/parameter/PageParameters.html#PageParameters%28%29

On a second though it might be even simpler not to use PageParameters (since
you might have too many filter form fields) but to add another constructor
to your SearchResultsPage that takes an instance to your SearchFilter POJO
and filters itself accordingly. I normally reuse my DAO mapped POJOs.

class SearchPanel ... {
  ...
  add("id", new SomeButtonSubmitLinkOrForm {
        @Override
      public void onSubmit() {
         // your biz logic creates an instance of mySearchFilter that
encapsulates your search parameters
         setResponsePage(new SearchResultsPage(mySearchFilter)); // create
this constructor and filter the page by it
      }
  });
  ...
}

~ Thank you,
  Paul Bors

-----Original Message-----
From: Daniel Watrous [mailto:[email protected]] 
Sent: Friday, June 21, 2013 5:40 PM
To: [email protected]
Subject: Re: Point Form action to Page

Within my SearchPanel onSubmit, how do I get the PageParameters to make that
call to setResponsePage? I hope I'm understanding you right.


On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors <[email protected]> wrote:

> There is a good reason why Wicket is not letting you override a form's 
> action attribute. Is at the core of its processing.
>
> If I understand you right you have a panel that processes a search 
> form and you would like to respond with SearchResultsPage.
>
> Wicket's way of doing that would be to use PageParameters. Add a 
> constructor to your SearchResultsPage that takes in an instance of 
> PageParameters and then pass your search parameters through it via 
> setResponsePage(new SearchResultsPage(mySearchPageParameters).
>
> If I didn't understand you right, then try to better explain your 
> use-case
> :)
>
> You might also be interested in the
> o.a.wicket.extensions.markup.html.repeater.data.table.filter package 
> :)
>
> ~ Thank you,
>   Paul Bors
>
> -----Original Message-----
> From: Daniel Watrous [mailto:[email protected]]
> Sent: Friday, June 21, 2013 5:13 PM
> To: [email protected]
> Subject: Point Form action to Page
>
> Hi,
>
> I have created a Panel that contains a search form. I can't figure out 
> how to get the "action" of the Form to submit to the search results 
> page. Any ideas?
>
> In other words, I was hoping to do something like this:
>
> form.add(new SimpleAttributeModifier("action", 
> SearchResultsPage.class));
>
> Thanks,
> Daniel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to