I am attempting to limit people to registering multiple times for an event. I want to query the dataset with an onChange event on the email input. So, if the email exists in the dataset the registration button will be disabled. I also want it to be able to disable/enable accordingly whether the input is a match or not. I will be adding something (ucase) to be sure there are no case discrepancies but one step at a time.
Here is what I have
export function iptEmail_change ( event ) {
let email = $w ( ‘#iptEmail’ ). value
wixData . query ( ‘Attendees’ )
. eq ( ‘email’ , email )
. find ()
. then (( results ) => {
if ( results ) {
$w ( ‘#btnRegister’ ). disable ()
} else {
$w ( ‘#btnRegister’ ).en able ()
}
})
console . log ( $w ( ‘#iptEmail’ ). value )
console . log ()
}
// I would like to know how to query the this function to pull the answer to the question “Did you find a match?” as well
This currently will always enable the iptRegister button with matches in the dataset and otherwise