Hi All,
I have a searchable library of dance instructors, filterable dance type, service type, etc. Search filters are already set up. Page here: https://www.swinghire.com/browse-instructors
I’d like to be able to link to this page, but have the “service type” pre-filled to “digital instruction and video feedback.” (I’m essentially just trying to have a go-to URL for promoting instructors who can teach online while the world’s in quarantine.) Is it possible to do this without just duplicating the whole page and adding a sort setting?
I am a beginner-beginner coder.
Thanks everyone!
You can use Wix Storage for this.
https://www.wix.com/corvid/reference/wix-storage.html
How do I pass data between pages in my site?
Use the wix-storage API. Use the setItem() function to place data in storage on the originating page. Then use the getItem() function to retrieve the data on the target page.
Hi GOS,
Thank you so much for such a quick reply! Forgive me, I am very beginner with corvid, so I still have questions.
If you’re able, would you possibly elaborate on that? I’ve been studying terms like Wix-storage and setItem() and getItem(), but I don’t yet understand how to implement them. I’ve never used anything with any of those terms before.
Would my code maybe look something like this? (again, sorry, this is bound to be terrible.)
Placed into the code of the page with the link:
import {local} from 'wix-storage';
$w.onReady(function () {
local setItem("servicetype", "digital");
Placed into the code of the page with the dropdown menu:
import {local} from 'wix-storage';
$w.onReady(function () {
let value = local.getItem("servicetype"); // "digital"
Simple website example here to show you how to do it with a dropdown.
https://givemeawhisky.wixsite.com/datatest/storage
First page with the dropdown choice being saved when user does it and then presses on the next page button.
import {local} from 'wix-storage';
$w.onReady(function () {
});
export function dropdown1_change(event) {
local.setItem("key", $w('#dropdown1').value);
}
Second page with the dropdown being set on page load with the choice of the dropdown from the previous page.
import {local} from 'wix-storage';
$w.onReady(function () {
$w('#dropdown1').value = local.getItem("key");
});
The “key” name can be whatever you want it to be, just make sure that they match on each page.
If you want that specific dropdown to have something displayed instead of select service type, then you can set a default choice in the dropdown settings on the page itself.
Or if you want to have the dropdown selected depending on user query, then have a look at this previous post here.
https://www.wix.com/corvid/forum/community-discussion/populate-dropdown-field-and-pre-select-one-option-for-the-user