I've been having this problem since last thursday.
When the form loads, most of the time, it returns an error stating:
An error occurred in one of datasetReady callbacks.
This is triggered in the
$w("#dataset1").onReady( () => {
$w("#dataset1").setFieldValues( {
"title": userId,
"email": userEmail,
} );
setFieldValues call, which is necessary for linking. Once this occurs, I can no longer save the form. The problem is intermittent (but very common) and occurs in live and preview mode.
www.ryanterminal.com/memberreservation is the live site.
This used to work fine before thursday, and I'm at a complete loss as to the nature of the problem. please help.
$w.onReady(function () {
//TODO: write your page related code here...
$w("#dataset1").onError( (operation, error) => {
let errorOp = operation; // "save"
let errorCode = error.code; // "DS_VALIDATION_ERROR"
let errorMessage = error.toString();
// DatasetError: Some of the elements validation failed
console ("dataset 1 error: "+errorMessage);
} );
// ...
var userId;
var userEmail;
let user = wixUsers.currentUser;
userId = user.id;
user.getEmail()
.then( (email) => {
userEmail = email;
//$w("#text53").text=email;
$w("#dataset1").onReady( () => {
//console.log ("UserID: "+userId);
//console.log ("Email: "+userEmail);
$w("#dataset1").setFieldValues( {
"title": userId,
"email": userEmail,
} );
$w("#Reserve").enable();
$w("#dataset1").onAfterSave( () => {
console.log("Form saved");
if(wixUsers.currentUser.loggedIn) {
wixLocation.to("https://ryanterminal.com/myreservations");
}
} );
} );
} );
});
Also note that commenting out the onAfterSave stuff does not fix the problem.
I (got around) this by moving the SetFields to an OnBeforeSave handler.
I still have no idea why this code started failing last thursday out of the blue, when it was working just fine before then.
Sorry the specific error is, There is no current item