Ok, I am clearly getting bold in my old age.
I have mastered the Single Field Search => Table and the Single Field Search => Individual Text Fields.
Now, what I would like to tackle is a situation where someone could input, say 5 ailments that they currently have (each housed in its own user-input box), and with the click of one button, have the results delivered to customized text fields.
I am practicing with 2 user input boxes, the output boxes, and the search button. I wrote the code based on what you guys had previously instructed me in, but I am getting one error message on the very last line that says “Unexpected token.” There is only a bracket on the last line.
Here is the code that I used:
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) {
//this would be from the first search field
wixData.query(‘Members-BodyLanguage’)
.contains(‘title’, $w(‘#searchByCondition’).value)
.find()
.then( res => {
//this is where you make the changes
$w(‘#bodyLangTitle’).text = res.items[0].title;
$w(“#bodyLangDescr”).html = res.items[0].meaningNew;
$w(“#bodyLangAntedote”).html = res.items[0].antedote;
//this would be from the second search field
wixData.query(‘Members-BodyLanguage’)
.contains(‘title’, $w(‘#searchByCondition2’).value)
.find()
.then( res => {
//this is where you make the changes
$w(‘#bodyLangTitle2’).text = res.items[0].title;
$w(“#bodyLangDescr2”).html = res.items[0].meaningNew;
$w(“#bodyLangAntedote2”).html = res.items[0].antedote;
});
}