I am currently trying to develop some way where new users on our website have to accept our terms of service and our privacy policy to finish registering. I currently have this done by proxy (one checkbox enables a button which enables the 2nd checkbox, then the 2nd checkbox enables the sign up button). However, I’m trying to use some code so that the button will become enabled when both checkboxes are checked so we don’t have to do an un-professional looking work-around. Here’s the lightbox page code:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#SignUp’).onClick( function () {
let email = $w(‘#registeremail’).value;
let password = $w(‘#registerPW’).value;
wixUsers.register(email, password)
.then(() => {
wixLocation.to(‘CustomerRecords/CUST/{CustomerNumber}’);
})
})
});
$w.onReady(() => {
$w(‘#ToScheck’).onChange(SignUpEnableDisable());
$w(‘#Privacycheck’).onChange(SignUpEnableDisable());
});
export function ToS_click(event) {
//Add your code for this event here:
if ($w(‘#ToScheck’).checked) {}
else
$w(‘#ToScheck’).enable()
}
export function PrivacyPolicy_click(event) {
//Add your code for this event here:
if ($w(‘#Privacycheck’).checked) {}
else
$w(‘#Privacycheck’).enable()
}
export function ToScheck_click(event) {
//Add your code for this event here:
$w(‘#ToScheck’).disable()
$w(‘#ToScheck’).checked
$w(‘#PrivacyPolicy’).enable()
}
export function Privacycheck_click(event) {
//Add your code for this event here:
$w(‘#Privacycheck’).disable()
$w(‘#Privacycheck’).checked
//$w(‘#SignUp’).enable()
}
function SignUpEnableDisable() {
if ($w(‘#ToScheck’).checked && $w(‘#Privacycheck’).checked){
$w(‘#SignUp’).enable()
}
else
$w(‘#SignUp’).disable()
}
However, this doesn’t work. Checking both checkboxes causes nothing to happen. [//$w(‘#SignUp’).enable() is being used as documentation to test the validation, it is actually present in our live site. This is the only way I’ve been able to get close to what we actually want, so we’re using it as a placeholder]