Hi, I currently have two basic searches set up on a page of a website, one for finding a musician’s name and another one for finding a word within a song name, then both search results are shown in the same results table.
However, is there a way that I can change the code so that I can have just the one search box for when people want to find either a musician’s name or part of a word from a song if they can’t remember the full song name?
I’ve looked on Wix Code Forum and can see code answers for multiple searches, however that is through searching a database with repeaters displayed on the page and people can choose from drop down options too, whereas I have just my repertoire database which is an alphabetical list of songs and the musician’s name which people can search through.
Talking of drop down, is there also a way to change the musican’s name search from a word search and have it as a drop down search instead, albeit with some of the code being able to edit out duplicates of any musician’s name, as I’ve tried adding a drop down choice for the musician’s name instead and I can never get it to hide any duplicates.
This is the code that I’ve used and is working fine as separate searches for either finding musician name or word/s from song name:
import wixData from ‘wix-data’;
//For full API documentation, including code examples visit http://wix.to/94BuAAs
$w.onReady(function () {
//TODO: import wixData from ‘wix-data’;
});
export function searchButton_onClick(event) {
wixData.query(‘RepertoireList’)
.contains(‘songName’, $w(‘#songnameinput’).value)
.find()
.then(res => {
$w(‘#resultsTable’).rows = res.items;
});
}
$w.onReady(function () {
//TODO: import wixData from ‘wix-data’;
});
export function searchButton1_onClick(event) {
wixData.query(‘RepertoireList’)
.contains(‘artistName’, $w(‘#artistnameinput’).value)
.find()
.then(res => {
$w(‘#resultsTable’).rows = res.items;
});
}
Any help for a novice wix coder would be must grateful, thank you!