top of page
Forum Posts
Stephen Milne
Mar 13, 2022
In Coding with Velo
I have this code working perfectily for searching database with a click import wixData from "wix-data";
$w.onReady(function () {
});
export function searchbutton_click(event) {
wixData.query("Tracking")
.eq("title", $w("#trackinginput").value.toUpperCase())
.find() // Run the query
.then(res => {
if(res.items.length > 0) {
$w("#noItemsText").collapse();
$w("#repeater1").data = res.items;
$w("#repeater1").expand();
}
else {
$w("#repeater1").collapse();
$w("#noItemsText3").expand();
}
}
);
} I would like to have the option of seaching with the "enter key" too, ie to have both, but have no idea where to go from here. Its running on http://ojizo.coffee/ojizo10percent You can see a displayed result using "0001" Any help would be greatly appeciated. Stephen
0
1
42
Stephen Milne
Mar 07, 2021
In Coding with Velo
Hey people, I have a simple data base query to search a tracking number. The tracking number is entered into input box and attached to a search button. The results (only one) is loaded into a repeater. The code is as import wixData from "wix-data";
$w.onReady(function () {
});
export function searchbutton_click(event) {
wixData.query("Tracking")
.contains("title", $w("#trackinginput").value)
.find() // Run the query
.then(res => {
$w("#repeater1").data = res.items;
$w("#repeater1").expand();
}
);
} No problems here. However, I would like to show a container box [noresultsmessage] if there are no results. I am not sure what code to use and would really appreciate any help. Cheers Stephen
0
2
108
Stephen Milne
More actions
bottom of page