Hello,
I have a search bar which allows a user to search a database and find relevant store locations which are nearest to them, depending on the suburb which they have entered in the search bar. The results are displayed on a new page via a repeater. At the top of the results page, I would like to have a sentence which says “Showing results for stores near (user input suburb)”
I haven’t been able to attain the correct code to allow such a sentence: the following is the code which I currently have, but the placeholder code (line 7 of ‘Results Page’) keeps returning an error saying that ’ The placeholder parameter that is passed to the placeholder method cannot be set to the value . It must be of type string.’
Search Page:
import {local} from 'wix-storage';
import wixLocation from 'wix-location';
$w.onReady(function () {
});
export function StoreSearchButton_click() {
let word = $w("#StoreSearchBar").value;
local.setItem("SuburbSearch", word);
wixLocation.to(`/copy-2-of-play`);
}
Results Page:
import {local} from 'wix-storage';
import wixData from 'wix-data';
$w.onReady(function () {
var sameWord = local.getItem("searchWord");
$w("#StoreSearchBar").value = sameWord;
$w("#StoreSearchBar").placeholder = sameWord;
$w('#dataset1').onReady(function () {
search();
});
});
export function searchButton_click() {
search();
}
function search() {
wixData.query('Stores')
.contains('storeAddress', $w("#StoreSearchBar").value)
.find()
.then(res => {
$w('#repeater1').data = res.items;
});
}
Any assistance or suggestions would be greatly appreciated.
Thank-you