Shouldn’t this code work
It would be better if I could write Example 1. It communicates more clearly and is grammatically correct ( I believe ). I think the constructor should cast to string naturally. Don’t begin to ask me how that is achieved but it would be really nice if I could.
in registerButton_click INFO
registermember INFO
me@here.ca INFO
myPasswordnot INFO
robert INFO
fontain INFO
Error: The value passed to the element selector function (usually $w), must be of type string at...ERROR
console.log( 'in registermember');
console.log( $w('#firstnameInput').value);
console.log( $w("#lastnameInput").value);
console.log( $w('#emailInput').value);
console.log( $w('#passwordInput').value);
// example 1
wixUsers.register( $w('#emailInput'), $w('#passwordInput'), {
contactInfo: {
"firstName": $w('#firstnameInput'),
"lastName": $w("#lastnameInput")
}
})
.then((result) => {
wixLocation.to('/thank-you?msg=MemberRequest');
})
.catch((err) => {
$w('#emailexistsText').show();
});
// example 2 - in search of equivalence
let firstName = $w('#firstnameInput').value;let
let lastName = $w('#lastnameInput');
let email = String($w('#emailInput').value) );
let password = $w('#passwordInput').toString;
wixUsers.register( email, password, {
contactInfo: {
"firstName": firstName,
"lastName": lastName)
}
})
.then((result) => {
wixLocation.to('/thank-you?msg=MemberRequest');
})
.catch((err) => {
$w('#emailexistsText').show();
});
// example 3 works:
function registerMember() {
let firstName = $w('#firstnameInput').value;
let lastName = $w('#lastnameInput').value;
let email = $w('#emailInput').value;
let password = $w('#passwordInput').value;
console.log('in registermember');
console.log( firstName);
console.log( lastName);
console.log( email);
console.log( password);
wixUsers.register(email, password, {
contactInfo: {
"firstName": firstName,
"lastName": lastName
}
})
.then((result) => {
wixLocation.to('/thank-you?msg=MemberRequest');
})
.catch((err) => {
$w('#emailexistsText').show();
});
}