Help needed - register function

Hi, I have been rebuilding my site and needed to create the functionality necessary to capture user data as part of the registration process. I have (among other sources) used the guide: Velo Tutorial: Creating a Custom Registration Form with Code | Help Center | Wix.com

The form is working fine - multiple tests of shown the data to be transferring up to the CRM correctly.

My problem is that I have tried to adapt the code given at the end of the registration form guide so that the data inputted into the form can be used to login correctly registered users.

The code given is:

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

My text fields are:
First Name
Last Name
Email
Password
Industry
Job Title

I then have two radio groups:
Age with 4 options
Education with 3 Options

My attempt (thus far):

import wixUsers from ‘wix-users’;

// register as member using form data
wixUsers.register($w(‘#input2’).value, $w(‘#input9’).value, {
“contactInfo”: {
“firstName”: $w(‘#input4’).value,
“lastName”: $w(‘#input1’).value,
“emails”: [$w(‘#input2’).value],
“password”: Number($w(‘#input9’).value)
“sector”: $w(‘#input6’).value,
“jobTitle”: $w(‘#input8’).value,
“age”: $w(‘#radioGroup1’).value,
“education”: $w(‘#radioGroup2’).value,
}
});

Any help would be much appreciated.

Hi Jamie!

I didn’t understand what the issue might be.
Please clarify on what you’re trying to achieve and where in the process you’re facing hard times.

Doron.

Hi Doron,

thanks for your reply.

I have placed a custom registration form in the sign-up process for site members.

While the form sends the information submitted to the CRM it does not then allow for the information submitted to be used for logging into the site.

I am looking for the easiest way to tie the information submitted in the custom form to allow users to fill in the form, become members and immediately be in a position to log in.

Any help would be much appreciated.

Thanks.

Could you use the .then function to re-direct them to the login page where they could enter the email and password they registered with allowing them to log in

Mike, thanks for your interest here.

The problem is not completion of the form or redirecting to the login page but the fact that the information entered into the form is not then recognised when trying to login.

I am looking for a way to get the information received by the CRM (via the form) to be recognised as a valid entry for login.

Any help would be much appreciated,

Jamie

@jamie59098 Do you have membership set to automatic approval in the CRM, if not you will have to go into the CRM and manually approve the new user account that has registered before they will be able to log in.

Hi Mike, I have toggled automatic approval on and off while running tests of the forms and CRM. Both produce the same result - data inputted into the form is not recognised as valid for login.

Jamie, if the users data has been captured in the CRM as you say it has and the CRM states that the user has “member” status, then the user should be able to login though the WIX login app. Are you using the WIX “member login app” when trying to log in ?

Alternately if you want to create a custom login page just use the code below:

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

$w.onReady( function (){

$w('#LoginButton').onClick( **function**  (){     

let email = $w(‘#LoginEmailInput’).value;

let password = $w(‘#LoginPasswordInput’).value;

    wixUsers.login(email,password)   

    .then(()=>{ 

        wixLocation.to('/home');    

        }) 

    }) 

})

Thanks Mike, that is much appreciated.

I have found the answer to the direct query I had, regarding the Register function.

The website: https://www.futurecoding.net/customeregistration not only provided the answer via a youtube video but also customized the code for me, according to my specific circumstances.

The site is now completed and live.