Custom Sign-Up Checkbox Group to Custom CRM Field on Editor X

Hi,
I have been trying for days to figure out how to pass a checkbox group’s value(s) to a custom field in my contacts. I’ve created a custom sign up lightbox in Editor X and cannot seem to get the custom field to update. I am a novice at coding but have been able to figure things out as I go. I’ve scoured the API references and the internet for an answer but I cannot figure it out. I have a custom contact field named “Types of Goats” and my checkbox group’s ID is typesOfGoats. Can someone please help me out or point me in the right direction? Thanks!


import { authentication } from ‘wix-members’ ;
import wixLocation from ‘wix-location’ ;

let emails = ;
let phones = ;

$w . onReady ( function () {
$w ( ‘#joinBtn’ ). onClick ( () => {
const password = $w ( ‘#password’ ). value ;
const email = $w ( ‘#email’ ). value ;
const phone = $w ( ‘#phone’ ). value ;
const typesOfGoats = $w ( ‘#typesOfGoats’ );

emails . push ( email );
phones . push ( phone );

let options = {
contactInfo : {
firstName : $w ( ‘#firstName’ ). value ,
lastName : $w ( ‘#lastName’ ). value ,
typesOfGoats : $w ( ‘#typesOfGoats’ ). value ,
emails : emails ,
phones : phones ,

 }, 
 privacyStatus :  'PUBLIC' 

}
authentication . register ( email , password , options )
. then (() => {
wixLocation . to ( ‘/plans’ )
});
});
});

Already resolved?

If not…this must be your ISSUE

const typesOfGoats=$w('#typesOfGoats');

CBG = Prefix for CheckBoxGroup!

let myCBGvalue = $w("#myCBG").value;
// you will get something like --> ["value1", "value2"]

As you can see, instead of just ONE VALUE —> you get a whole bunch of values!!!
You get an ARRAY, filled with values —> […, …, …, and so on…].

To get a SPECIFIC-VALUE → you will need to tell the ARRAY, which index you want to select to get the corresponding value…

let myCBGvalue=$w("#myCBG").value[0]; console.log(myCBGvalue);
let myCBGvalue=$w("#myCBG").value[1]; console.log(myCBGvalue);

Sorry for the extremely late response. I figured out a workaround but this definitely does help. I’m taking a coding class to learn the basics so I don’t have to beg for help. Thanks again!

1 Like