Create a searchable form with check button connected with database

We are a offline training provider company so whenever we provide a certificate to any candidate it has special code suppose XXX. I want such a feature that "when visitor visit our website then go verify tab where they can enter this code and enter the check button to verify the certificate and the website will show “Yes, this person has taken training on ‘Subject’ with us on date: DD-MM-YY” if he/she has taken training with us. If not then It will show “No this person has not taken any training with us”. Below is the example of the site feature that I am looking about in wixPlease go to https://verify.huii.in/ and USE CODE: 20-29227 to understand what I am looking for. Please help guys.

Hello,

You could achieve that by saving all the codes in a dataset. Once the code is entered in the User Input element, the user will click the “Verify” button. You will need to use event handlers here.

For example, onClick you can query the dataset that includes the code and the other required information (training subject, dates, etc.), then you populate the information accordingly (in a table or a repeater).

API references that you can use:
query()
eq()

Also check another related forum post that might be helpful here .

Good luck!

I did someting similar but now I am facing one problem

When ever I click on preview button at editor then when the input is entered it shows the desire output.

But when I publish the website It is not showing the desire output.

Code:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import {search} from ‘backend/dquery’;
$w.onReady( function () {
$w(“#text45”).hide();
$w(‘#text44’).hide();
$w(‘#box1’).hide();
$w(“#button7”).onClick( (event) => {

$w(“#input14”).inputType = “number”;
let ID=$w(“#input14”).value;

const ID1=parseInt(ID.valueOf());

console.log(ID1) // “myElement”
search(ID1).then(result => {
console.log(result);
$w(‘#text45’).show();
$w(‘#box1’).show();
$w(‘#text44’).show();
$w(‘#text45’).text=result;

// Logs: 20
})
. catch (error => {
console.log(error);
});
} );
//TODO: write your page related code here…
});
export function button1_click(event) {
//Add your code for this event here:
}

Kindly suggest me how to fix this

Most common causes: you didn´t sync the db to Live or the Permissions on the dataset do not allow access.