Hi there. I’ve been trying to create a registration form by following the instructions and example provided at Velo Tutorial: Creating a Custom Registration Form with Code | Help Center | Wix.com . The user input form page I’m working on is currently at https://scottoffline.wixsite.com/homepower/copy-of-contact-1
Very new to JS, I quickly hit a wall and asked a developer friend (who’s not a Wix user) to review the code. He/We came up with the following code. I’ve cleared the errors (I think), but it still isn’t working.
Any suggestions or troubleshooting help is greatly appreciated. Thanks in advance.
Scott
import wixUsers from ‘wix-users’;
$w.onReady( function () {
$w(‘#button1’).onClick( () => {
let email = $w(‘#input3’).value;
let password = $w(‘#input4’).value;
let radioGroupSelection;
const selectionValue = $w(‘#radioGroup1’).value;
//determine mailing selection
if (selectionValue === “Both”) {
radioGroupSelection = “Home Power and its partners”;
} else if (selectionValue === “HP”) {
radioGroupSelection = “Just Home Power”;
} else if (selectionValue === “None”) {
radioGroupSelection = “No thanks”;
} else {
radioGroupSelection = “something went wrong if we got this far”;
}
// register as member using form data
wixUsers.register(email, password, {
“contactInfo”: {
“firstName”: $w(‘#input1’).value,
“lastName”: $w(‘#input2’).value,
“email”: [$w(‘input3’).value],
“labels”: [radioGroupSelection],
//still part of options hash passed into register function along with email and
// pw params, but we can’t use a number here due to the value of selectionValue
// coming from the radio group selection, which is gonna be a string.
“selectionValue”: $w(‘#radioGroup1’).value
}
}).then( (result) => {
let status = result.status; // “Active”
let user = result.user;
});
});
});