We created a custom membership form that was not working properly, allowing you to skip through the form without filling out required fields, and even if you did fill them out and signed up, it would not register any information.
Fast forward, someone responded to the forum post regarding this original problem, providing the necessary code:
import wixUsers from 'wix-users'; import wixLocation from 'wix-location'; $w.onReady(function () { $w('#signup').onClick( () => { let participatingagent = $w("#participatingagent").value let email = $w("#email").value let redidagent = $w("#redidagent").value let officephone = $w("#officephone").value let fax = $w("#fax").value let participatingfirm = $w("#participatingfirm").value let agentcell = $w("#agentcell").value let redidoffice = $w("#redidoffice").value let address = $w("#address").value let password = $w("#password").value let upload = $w("#uploadbutton").value wixUsers.register(email, password, { "contactInfo": { "participatingagent": participatingagent, "participatingfirm": participatingfirm, "redidagent": redidagent, "redidoffice": redidoffice, "agentcell": agentcell, "officephone": officephone, "fax": fax, "address": address, } }) .then((result) => { wixLocation.to('/plans-pricing'); }); }); });
Now, when you go to the form, the required fields need to be filled out, and registration goes through when you sign up. However, it is not capturing all the data in the Contact List. The necessary fields are there (each field was synced with Contacts), however most of them are blank, even after filling them out during registration.
The "PrivateMembersData" database does not work because it does not match with the fields in our custom registration form, but it does log the info that we do have in the form that matches with the database (e.g. email, phone, etc.) Is there specific script that needs to be added to this database to change the database fields properly?
Is there a way we can edit these fields to match our registration form? We also created a separate database with the same titles of the fields in the registration form. If so, how do we connect it/replace the "PrivateMembersData"? Not sure which approach to take, if either of these are the way towards the solution, but would appreciate guidance on this!
Whatever you include in your register form is what gets collected.
See the register api and 'Register a user as a site member with registration options' for more info.
https://www.wix.com/corvid/reference/wix-users.html#register
These are the fields that you can use to collect registration info in the Wix PrivateMembersData collection when users first register.
https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields
If you want more info, then you can create your own members dataset and each member can have their own profile page which can be updated with whatever user inputs you want.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area
This is my own sign up lightbox code which works perfectly and closes after registering details before moving user onto signup status page, then both names will be saved in contacts and once site member is approved the member details will be added to 'members' database (which I have added as a separate dataset similar to the example in the building your own members area tutorial above).
You can add custom fields to your contacts.
https://support.wix.com/en/article/adding-custom-fields-to-contacts
Plus you can create a new contact without registering the user by viewing the create contact example below, which would need the Wix crm import at the top of your code..
https://www.wix.com/corvid/reference/wix-crm.html#createContact
The create contact is something I have done on my own website after a user has submitted a user input form with an on after save hook, which runs first and gets the values before entering them into my contacts and then sending my triggered email afterwards.
As @givemeawhisky wrote, you need to first define your members custom fields: https://support.wix.com/en/article/adding-custom-fields-to-contacts. Then the additional fields you send as ContactInfo on register() will be populated to these fields.
@givemeawhisky @Ohad Laufer,
Custom fields were already added to Contacts. The problem is that when you fill in that information, it is not being captured after you register.
You should make sure that the custom fields' types are set properly. Also, in order to set their value - use the field name, lower case, with spaces, so, for example, for "Agent Cell Phone" you should use:
Ohad, this was already done. Still not working
Try something like this and make sure that you use the correct code in your original post too as you are missing ; on some lines and you have contact info enclosed in "".
@givemeawhisky thank you!
I owe you a whisky! ;-)