Ok, so here is what I am trying to do. I have created a site where (logged-in)members submit information through a form and I need to show that information on a “Past Submissions” page. I figured the best way to do something like this was to:
- have a collection where the form submissions go (done)
- since users are logged in, I was hoping to be able to collect their emails, or something that uniquely identifies them
- Upon collecting their emails, I was hoping to add “email” as a column to the form submission data, and put their email there with the rest of it.
- then, I would’ve created a dynamic page(the submission page) for users, where I display certain columns from the form submissions
- Then, I use a filter feature by rows(not sure if this one would work), and if the user’s login email matches the email in that row, only those rows show up, meaning that they only see the rows attached to their emails (also, the email column wouldn’t be displayed here)
So I’ve been looking through a few resources on Corvid, and am unsure on how exactly to do this, or produce a similar result with a different process. Keep in mind I am new to Javascript and more familiar with Java, so please be detailed in how to carry things out in terms of syntax.
I was a little bit confused with how to carry out a few of the steps above, however. For step 2, I used this article , which didn’t work for me. This was my code:
(button2 is the submit button for the form. I’ve ensured all the names for the collections are correct, but when I view the collection, nothing changes in the email column I created, and I don’t receive any sort of error that I’ve seen)
import wixUsers from “wix-users” ;
import wixData from ‘wix-data’ ;
let user = wixUsers.currentUser;
let userEmail;
user.getEmail()
.then( (email) => {
userEmail = email;
} );
export function button2_mouseIn(event) {
let toInsert = {
“email” : userEmail
};
wixData.insert( “multiStepRegistrationForm3” , toInsert)
.then( (results) => {
let item = results; //see item below
} )
. catch ( (err) => {
let errorMsg = err;
} );
}
Later, I found this link which should’ve also been able to help me. It provided this code to receive member data:
wixData.query( “Members/PrivateMembersData” )
.find()
.then( (results) => {
// handle the results
} );
It wasn’t really specific on how to handle the results, and I tried looking elsewhere, have no idea syntactically how to pull out the user’s login email. I also stumbled upon the UserInfo feature, but I ran into a similar issue; it also wasn’t specific in terms of how to actually apply it.
So currently I am stuck on steps 2 and 3. Any specific , detailed code or help would be much appreciated.
Edit: To anyone who may be looking to do what I am doing, there is a MUCH simpler way: while this may be helpful, you can restrict the data that appears from a Form Submission data collection by using a filter on it. Wix provides a filter and, using the link from step 5 above, you can restrict the data that is shown to a specific user, by limiting them with the “Owner” filter, and it only shows the user the data that they have inputted when logged in.