I had a hard time figuring out how to follow your second suggestion and making it work for my use case. Instead I ended up calling parameters.clearNamed();
After I got the search term. That kept it out of my URL. I also added a "clear search" link that unset the search filter parameter in my DataProvider. Thanks for your help. Daniel On Sat, Jun 22, 2013 at 10:45 AM, Paul Bors <[email protected]> wrote: > Try the second approach. There would be no query parameters to worry about. > > You can construct your page by taking as a constructor parameter a POJO > that's the model object for the filter form. You can also have a default > constructor that would construct the page with no filters. > > ~ Thank you, > Paul C Bors > > On Jun 21, 2013, at 18:11, Daniel Watrous <[email protected]> wrote: > > > That first approach worked, but it brings me back to another issue: I end > > up with a query string parameter > > &searchFilter=quick > > > > This is the same problem I was running in to here: > > > http://apache-wicket.1842946.n4.nabble.com/form-GET-and-POST-getting-mixed-up-td4659427.html > > > > When I try to load the page again, it keeps replacing that query string > and > > so I can't get back to a broad result. > > > > Is there some way to clear the search (by clearing the query string > > parameter)? > > > > Daniel > > > > On Fri, Jun 21, 2013 at 3:51 PM, Paul Bors <[email protected]> wrote: > > > >> 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] > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
