Registration code help

Hello, I am trying to make a registration page with two submit buttons, one takes you through a payment portal the other skips the payment.

Currently I am using a wix payment form. The registration button is tagged to the payment from the form (ideally this should create an annual subscription but one thing at a time I guess).

I don’t want anyone to be able to “register” without completing the required parts of the registration. I am having trouble making it a requirement to select “at least one” of the “roles”.

The page is also registering members if they only complete the email and password.

The register without donating button is saving the information to a contact list as “unlabeled” which I would like to have a label for and if the roles are not checked it does not show up on the contact list when I want it to show unchecked.

If anyone could help with one of these issues, it would save me a headache :joy:


import wixUsers from 'wix-users';

$w.onReady(function () {
 $w('#button2').onClick( () => {
 let emails = [];
 let labels = [];  
 
    emails.push($w('#email').value);

 // register as member using form data
    wixUsers.register($w('#email').value, $w('#password').value, {
 "contactInfo": {
 "firstName": $w('#DisplayName').value,
 //"lastName": $w('#lastName').value,
 "emails": emails,
 "labels": labels,      }
    });
 
  });
});

$w.onReady(function () {
 $w('#button3').Submit( () => {
 let emails = [];
 let labels = [];  
 
    emails.push($w('#email').value);

 // register as member using form data
    wixUsers.register($w('#email').value, $w('#password').value, {
 "contactInfo": {
 "firstName": $w('#DisplayName').value,
 "First Name.": $w('#FirstName').value,
 "Email":  $w('#email').value,
 "Phone":  $w('#Phone').value,
 "Address.":  $w('#Address').value,
 "Suburb":  $w('#Suburb').value,
 "City.":  $w('#City1').value,
 "Postcode.":  $w('#Postcode').value,
 "ECE teacher - Education and c":  $w('#checkbox2').value,
 "ECE teacher - Free Kindergard":  $w('#checkbox10').value,
 "Te Kohanga Reo kaiako (qualif":  $w('#checkbox9').value,
 "ECE teacher - Home based (qua":  $w('#checkbox3').value,
 "ECE teacher - Hospital ECE (q":  $w('#checkbox11').value,
 "ECE teaching support - educat":  $w('#checkbox12').value,
 "Te Kohanga Reo teaching suppo":  $w('#checkbox4').value,
 "Home-based carer (not a quali":  $w('#checkbox6').value,
 "Playcentre parent":  $w('#checkbox17').value,
 "Other ECE staff":  $w('#checkbox18').value,
 "Centre Owner":  $w('#checkbox8').value,
 "Employee of an ECE support or":  $w('#checkbox1').value,
 "Parent":  $w('#checkbox16').value,
 "Academic Role":  $w('#checkbox5').value,
 "Teacher (non-ECE)":  $w('#checkbox7').value,
 "Ministry of Education":  $w('#checkbox13').value,
 "Health Sector":  $w('#checkbox15').value,
 "Other Government Agency":  $w('#checkbox14').value,
 "Design and/or architecture":  $w('#checkbox19').value,
 "ECE related Supplies":  $w('#checkbox20').value,
 "Other":  $w('#textBox1').value,   }
    });
 
  });
});

One option would be to deactivate your REGISTRATION-BUTTON.
And only if all requiered fields were filled up, you activate the button again to fullfill the registration.

An good example for such situation, you will see here…
I think this is exactly what will help you out of your issue…
https://russian-dima.wixsite.com/meinewebsite/enable-button-check

Make an if-query and check if all needed check-boxes were activated, or at least one of them was checked.

if () {} else {}
if($w('#checkbox16').value=== xxxxxx) {do something}
else {do something else}
let isChecked = $w("#myCheckbox").checked;

if(isChecked) {do something}
else {do something else}