I have a form to collect data but I need the user’s email without adding an email field to the form so I’m using the beforInsert hook but it’s not working. What is the best way to automatically add the user email on submit.
If you know that the user who fills out the form is going to be a logged in site member, then you can simply set up a read only user input field that is connected to the Wix Members app Members/PrivateMembersData collection already.
As the site member is already logged in, the email shown here will be the site member’s own email specific for that site member from the Wix Members collection.
You can have this email hidden or shown on the page and as it is a user input, it will be included in the submit button for your form.
Thank you for the answer, but how could you connect one input element to 2 datasets, I need to connect it to the members dataset to get the value and to my dataset to save it with the form.