----Sometimes you just need to look back on the database settings ----
Yeah I know, the resources for this should be sufficient . Still, after retrying all of what I can, I seem to canāt pass by this error. It works on the preview, but surprisingly, it does not on the live
. Hereās the background:
Iām trying to create a registration form for a subevent of a Major Event. The user will input his name and choose one more input from a dropdown. Then upon onClick of the āsearchā button, it will query a database and check if you are registered to that Major Event and will be displayed to a repeater below the input and dropdown input elements. The code for that works fine. hereās the problem. The repeater has a button inside it that has no connection to whatsoever database. Its purpose is to copy the items queried from the input elements to another database for the subevent. But first, it will check if the queried values are already present in the subevent database. If yes, it will display a message, if no, it will proceed to the registration. The code for that checking to the subevent database is what Iām having errors with. Here is the code:
export function button47_click(event, $item) {
let currentItem = $item('#dataset1').getCurrentItem();
let name = currentItem.fullName;
let church = currentItem.church;
let email = currentItem.email;
$w("#button47").disable();
wixData.query("OBQBRegistrants")
.eq("fullName", name)
.and(
wixData.query("OBQBRegistrants")
.eq("church", church)
)
.limit(1)
.find()
.then( (results) => {
console.log(results);
if (results.items.length > 0) {
$w("#text196").show()
} else {
$w("#dataset2").setFieldValue("fullName", name);
$w("#dataset2").setFieldValue("church", church);
$w("#dataset2").setFieldValue("email", email);
$w("#statebox8").changeState("Reg1")
//.then(() => {
$w("#progressBar1").show("fade");
$w("#group109").show("fade");
$w("#progressBar1").value = 1;
//});
}
});
//let ex = items.length;
//.catch((err)=>{
// console.log(err);
//})
}
⢠button 47 is the button inside the repeater
⢠dataset 1 is connected to the Major Event database which was filtered already from user inputs
⢠dataset 2 is connected to the Major Event database
⢠the error I got from the console is āUncaught (in promise) Error: Unable to handle the request, contact site administratorā and it points to the line:
.then( (results) => {
I read this support article: Velo: Working with Promises | Help Center | Wix.com
yet, I did not manage to find the right answer
EDIT/ADDITIONAL
email field from the Major Event database is not displayed on the repeater. I just want to extract the email field of the queried results and copy it also to the subevent database
let email = currentItem.email;
P.S. donāt mind the notes, I sometimes copy and paste them if I need them or just delete them if all works fine.