Hi,
In the process of making a search bar.
I have used an input box on my header and set it to open to a dynamic page where my search results will show, I need the info from my search bar on my header to show in the search bar on the page as it cannot leave the page as it will disconnect from dataset.
I have used following code on my header;
export function searchButtonHeader_click(event) {
wixLocation.to(“/Stores/Products?search=”+$w(“#searchFieldHeader”).value);
}
This opens a new page and puts the input in the url as ‘search= data inputted’
I know just want this data to appear in my other box on my dynamic page, I think I have missed something though?
Here is my dynamic page code;
import wixWindow from ‘wix-window’;
import {local} from ‘wix-storage’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
//---------------------------------------------
function filter(title) {
$w(‘#dynamicDataset’).setFilter(wixData.filter().contains(‘name’,title));
}
export function searchButtonPage_click(event) {
filter($w(‘#searchFieldPage’).value);
}
$w.onReady( function () {
let query = wixLocation.query;
let searchWord = query.search
$w(‘#searchFieldPage’).value = local.getquery(“searchWord”)
$w(“#searchFieldPage”).onKeyPress((event, $w) => {
if (event.key === “Enter”) {
filter($w(‘#searchFieldPage’).value);
}
})
})
//----------------------------------------
$w.onReady( function () {
if (wixWindow.formFactor === “Mobile”) {
$w(“#column5”).collapse();
}
});
Any Help much appreciated.
Thanks
Matt