Custom Approval Form

I created a custom approval form that users must fill out to become a new member. I need the information from the form to show up in the pending request. I created custom labels and fields in my contact CRM, but all I see when I receive a new member request is the following


Please see the screenshot below of custom form that users need to fill out when they request a membership. The code that I wrote for this custom member approval form is here:

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
// For full API documentation, including code examples, visit http://wix.to/94BuAAs
$w.onReady( function () {
$w(‘#register’).onClick( function () {
let FullName = $w(‘#Full Name’).value;
let Credentials = $w(‘#Credentials’).value;
let Practice = $w(‘#Practice’).value;
let StateProvince = $w(‘#StateProvince’).value;
let Country = $w(‘#Country’).value;
let email = $w(‘#email’).value;
let password = $w(‘#password’).value;

// register as member using form data
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“fullName”: $w(‘#FullName’).value,
“Credentials”: $w(‘#Credentials’).value,
“Practice”: [$w(‘#Practice’).value],
“StateProvince”: [$w(‘StateProvince’).value],
“Country”: Number($w(‘#Country’).value)
}
});
// Here we create the contactInfo Object
let contactInfo = {
“emails”: [email],
“FullName”: FullName,
“Credentials”: Credentials,
“Practice”: Practice,
“StateProvince”:StateProvince,
“Country”:Country
};

// Include the contactInfo in registration
wixUsers.register(FullName, Credentials, Practice, StateProvince, Country, email, password, contactInfo) .then(() => {
wixLocation.to(‘www.vitalvet.org/thanks’);
});
});
});
//TODO: write your page related code here…
export function register_click(event) {
$w(‘#register’);
}


Please tell me what I am doing wrong because it still does not work properly.

Thanks!!
johanna

Follow this procedure…

Hi Mike,

I looked over the link you sent, but I’m still not totally clear as to which part of my code will collect the info need to gather from prospective members. When someone requests to become a member, I need to see the following info before I can approve them: first name, last name, credentials, name of practice, state/province, & country.

Below are screenshots of my form, the code for that page, and the notification I receive when someone tries to register. As you can see, the only info that is shows is the “EMAIL” and “ADDRESS”. I did create a database to collect all the information from the form, si it is collected. However, I also need the info that I listed above to be visible when I receive a notification for “New Site Member Request”.

Please help to understand how I do this.

In addition, I copied the exact code here. Feel free to tweak it so it will collect the info from the form and display in on the “New Site Member Request”.

import wixUsers from ‘wix-users’;

$w.onReady( function () {
$w(‘#register’).onClick(() => {
const Credentials = (‘#Credentials’).value;
let label;
let Practice = $w(‘#Practice’).value;
let StateProvince = $w(‘#StateProvince’).value;
let Country = $w(‘#Country’).value;
let email = $w(‘#email’).value;
let password = $w(‘#password’).value;

// Here we create the contactInfo Object
let contactInfo = {
“Credentials”: Credentials,
“Practice”: Practice,
“StateProvince”: StateProvince,
“Country”: Country
};

// Include the contactInfo in registration
wixUsers.register(email, password, Credentials, Practice, StateProvince, Country, contactInfo).then(() => {
wixLocation.to(‘www.vitalvet.org/thanks’);
});
});
});
//TODO: write your page related code here…
export function register_click(event) {
$w(‘#register’);
}

Thanks, Again!!!

When you approve a member does all the missing information appear or is it still missing after you approve the member ?

If the info is still missing then the information is not being passed to the CRM in the first place.

Have you created the additional fields in the CRM for the innformation you are trying to capture i.e. country, stateProvince, etc ?

Note the field ids always start with a lower case letter…

Hello Mike,
To answer you last question, the missing information still does NOT appear after I approve the member. I did created the additional custom fields Please see my screenshot. The only way I can retrieve the info (credentials, name of practice, state/province, country, password, etc) is if I manually go into the database that is connected to the New Member Application form. Therefore, you’re correct in suggesting that the information is not being passed to the CRM in the first place. Can you please tell me what I am doing wrong?

delete all your page code and replace with this…

import wixUsers from ‘wix-users’;
import wixLocation from “wix-location”;

$w.onReady( function () {

$w('#register').onClick(() => { 

    wixUsers.register($w('#email').value, $w('#password').value, { 

“contactInfo”: {
“credentials”: $w(‘#Credentials’).value,
“practice”: $w(‘#Practice’).value,
“stateProvince”: $w(‘#StateProvince’).value,
“country”: $w(‘#Country’).value

            } 
        }) 

        .then(() => { 

            console.log('user registered successfully'); 

            wixLocation.to('https://vitalvet.org/thanks'); 

        }) 
}) 

})