I’m trying to add a user that registers to my site to a custom collection that will later handle access to files etc…
Here is what I got on my custom sign up form:
import { registration } from 'backend/registrations';
$w.onReady(function () {
$w('#registrationForm1').onWixFormSubmitted((event) => {
console.log('trigger registration');
registration({
firstName: event.fields[0].fieldValue,
lastName: event.fields[1].fieldValue,
email: event.fields[2].fieldValue,
numberOfDownloads: 0,
});
return event.fields;
});
});
import wixData from 'wix-data';
export function registration(details) {
try {
wixData.insert('UserDownloads', details);
} catch (err) {
console.log(err);
}
}
The issue i am having is that once the form is submitted my function to add a user to my collection does not work… And when I target the submit button and try to get the values of the input fields they are always blank…
anyone got any idea how I’m supposed to submit data from a registration form to a collection?