Hello,
I’ve used input fields as sorbonneId for users’ ID and, sorbonnePassword for users’ password, I’m trying to run an onClick handler using a Sign In Button. However, the button is supposed to compare the user’s ID and Password with the ones saved in Data Collection, named instructorLoginCredentials , but nothing happens when I click on it, the text field and logs don’t appear, which denotes it isn’t even comparing?
Here’s what I’ve tired:
import wixData from 'wix-data';
import wixLocation from 'wix-location';
console.log("Openinng : Signin Lightbox");
let password = $w('#sorbonnePassword').value;
let identity = $w('#sorbonneId').value;
export function signInButton_click(event) {
$w('#infTxt').show('slideIn');
console.log("Establishing Connection");
wixData.query("instructorLoginCredentials")
.eq('soInstructorIdentity', identity)
.eq('soInstructorPassword', password)
.find()
.then((result) => {
if (result.items.length > 0) {
console.log("Credentials Found");
wixLocation.to('/my-account/${results.items[0]._id}')
} else if (result.items.length === 0) {
$w('#notFoundMsgBox').show();
} else {
$w("#errorMessage").show();
console.log("Credentials Not Found");
}
})
.catch(err => {
console.log("Unable to access collection: " + err)
})
}
I have read articles from Corvid itself and also scrutinized a few answers, from forum questions, everything seems to be perfectly fine. How can I make it work?
Thanks,
Lee