Hi guys,
Need some help please.I don’t have any coding experience but i use the below code and it works fine. When users inputs the exact value that’s in the database, my table displays it.
What i would like is to add some “conditions” to my code.
If form (#input1) is blank, return message “please input title”
If value doesn’t match with the database, return the message “No titles found”
import wixData from ‘wix-data’;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady( function () {
//TODO: write your page related code here…
});
export function searchButton_onClick(event) {
wixData.query(‘MyDatabase’)
.eq(‘Title’, $w(‘#input1’).value)
.find()
.then(res => {
$w(‘#table2’).rows = res.items;
$w(‘#table2’).show();
});
}