Clear persistent parameter in form action
- Dragonn
- Member | 12
Hi there!
I am trying to get VisualPaginator work with my search form. I (searched forum and) added persistent param $query to presenter which is holding searched string across pages and VP works pretty well now. I use AJAX to switch pages and it's Okay too.
Now I want to make URLs more friendly and strip off $query param where it's not needed (= everywhere but paginator). It's a bit anoying to add “query=>NULL” into every link leading to same presenter. I didn't find any other solution :-/, but OK … it works.
Only problem is in search form's action. First search is ok, there were NULL value in persistent param, URL is OK:
/profile/search?do=searchProfileForm-submit
but when I submit search again I can see $query param is in URL and I don't know how to strip it out:
/profile/search?query=foo&do=searchProfileForm-submit
I have tried some ways like force form action:
but even if dumped value is OK “/profile/search”, after submitting search form there is still $query param in URL.
I tried to search source code with no success … I don't even know which method is rendering form :-(.
Please can you give me any clue?
- Oli
- Member | 1215
I would say, that the $form->setAction
is unnecessary.
I guess, You can set persistent param NULL like this:
You will have your persistent param null, until you will send form and
$val->name
in $this->query
after form
sending.
Im not sure, if you can invalidate this form component. I guess yes, because if you invalidate it, you will send it again and $this->query will be reset but im not sure.
- Dragonn
- Member | 12
Thanks for replay, but it didn't help.
I don't send form via AJAX, searching is post request and page changing is handled by JavaScript. I'm invalidating just data and paginator (in separated snippets due to different redraw style).
When I set $this->query to NULL in form factory, it would be rewritten when I am handling POST. Also I need it while rendering due to correct paginator links.