brad
October 2, 2019, 5:01pm
1
I have a page that searches a dataset. The found records link to a details page. Of course that’s the easy part.
However when you go back to the search page you have to enter all your search criteria in again. Is there a way to have it remember the last entered search so it doesn’t have to be entered every time?
Teodor
October 2, 2019, 5:05pm
2
Hi Brad,
Yes, just store the search term in a query parameter, using the state management.
brad
October 2, 2019, 5:09pm
3
Thanks Teodor, you make it sound so simple.
I assume it would look something like:
1 - set parameters based on value of the form fields
2 - set the default value of the form fields to those parameters
Is that close?
Teodor
October 2, 2019, 5:18pm
4
Input > dynamic attributes > value > set the query param value, and then select the input > on keyup with debounce like 300ms you set dynamic event > set query param value and select the input value there
brad
October 2, 2019, 5:37pm
5
I must be missing a step …
I added my Query Manager Variable
Selected my input field
On my keyup event I have:
But it isn’t working. I am obviously missing something.
Teodor
October 2, 2019, 5:38pm
6
What is not working, exactly Brad?
brad
October 2, 2019, 5:38pm
7
When I go back to the search form page the value in the search field is blank.
Teodor
October 2, 2019, 5:40pm
8
Is the value added to the query param at first place?
brad
October 2, 2019, 5:40pm
9
How would I find that out?
Teodor
October 2, 2019, 5:41pm
10
Brad… When you type something in the search field, does it get added as a parameter in the address bar after the URL?
brad
October 2, 2019, 5:44pm
11
Yes it does. I can display the variable on the page …
And itt does show in the address bar …
Teodor
October 2, 2019, 5:45pm
12
So, next question - how do you redirect back from the details page to the search page?
brad
October 2, 2019, 5:46pm
13
Just a link to the search page?
Teodor
October 2, 2019, 5:49pm
14
Well, that won’t work as the link doesn’t contain your url params.
Use javascript:history.back() instead
brad
October 2, 2019, 5:54pm
15
Alright, I was hoping to avoid using the history, but if that is the only way I will live with it.
Thanks again for the great support!
1 Like
Teodor
October 2, 2019, 5:56pm
16
Then you can store the search values in a session, not in a query parameter
1 Like
brad
October 2, 2019, 6:07pm
17
Problem number 2 …
How do I set the variable or session based on the value of a dropdown? There is no ‘keyup’ for a dropdown menu.
Teodor
October 2, 2019, 6:09pm
18
Try using the on change event, currently on my phone so I can’t recall how was it exactly called
1 Like
brad
October 2, 2019, 6:17pm
19
‘Value Updated’ seems to work. I have it working perfectly with variables now. I want to try and do it using session variables though. But at least I have a way to make it work.
Thanks again, I really owe you guys beers some day.
1 Like
Hi Brad, it would be great if you could show clearly the steps needed so we can all benefit