Hello, I have a similar problem. Parsing error with onReady function - I think I'm close!
SITUATION: I am trying to filter a data collection by the login user's email address. As Admin I have added the initial records to the collection and need the ability for my members to update their address information as needed.
More than half of our members may not edit their information nor go online at all but I need everyone's info for our roster (which is displayed in a repeater on a page visible to Members). Many of our members are elderly and are not computer savvy.
As admin, I add the initial record when I approve the member at registration
Here is the code I am using to fill an input field with the logged in user's email address and then trying to use that to filter the data collection which is Read/Write so they can then edit it (on a Member page). I have a parsing error and can't figure out what token is missing to make the code work. I hope someone can take a quick look to help.
import wixUsers from 'wix-users';
import wixData from "wix-data";
$w.onReady(function ()
{ $w("#dataset5").onReady( () => { //DocentRoster data set
let user = wixUsers.currentUser;
let userId = user.id;
let isLoggedIn = user.loggedIn;
let userRole = user.role; user.getEmail() .then( (email) => {
let userEmail = email;
$w('#input40').value = userEmail; $w("#dataset5").setFieldValue("loginEmail",$w('#input40').value);
let filter = $w("#input40").value; $w("#dataset5").setFilter(wixData.filter().contains("docentEmail", filter));
wixData.query("DocentRoster")
.contains("docentEmail",$w("#input40").value)
.find()
.then(res => { $w('#box35').expand();
}
);
Box35 has the fields I want the user to be able to edit (address, phone, comments, preferences, etc.). All are from the DocentRoster set up as Read/Write with no filter.
Thanks in advance if anyone can spot what's I've done wrong.