Trying to figure out how to save custom Fields during user registration.

So I’ve added a custom field via Contacts → More Actions → Manage Custom Fields.
Called the new field: dealerRequest and set it as Text.

I’ve created a custom dealer registration form and trying to save a text field input when executing the wixUsers . register function as part of the contactInfo part.

This is the code I’m using:

wixUsers . register ( $w ( ‘#inputEmail’ ). value , $w ( ‘#inputPass’ ). value , {
“contactInfo” : {
“firstName” : $w ( ‘#inputFirstName’ ). value ,
“lastName” : $w ( ‘#inputLastName’ ). value ,
“emails” : emails ,
“labels” : labels ,
“dealerRequest” : String ( $w ( ‘#textBoxProof’ ). value );
}
});

However - this is not accepted and the “dealerRequest” : String ( $w ( ‘#textBoxProof’ ). value ); line is marked red in the editor with an error: " Type ‘{ firstName: string; lastName: string; emails: string; labels: string; dealerRequest: string; }’ is not assignable to type ‘ContactInfo’. Object literal may only specify known properties, and ‘“dealerRequest”’ does not exist in type ‘ContactInfo’. It’s recommended you use a new variable, such as “let newVar = …” to make sure that all code completion work correctly."

I’ve followed the sample code in this article (they are using a custom field named “height”): https://support.wix.com/en/article/velo-tutorial-creating-a-custom-registration-form-with-code but this does not work for me.

Can anyone suggest what am I doing wrong?

I had this as well, I don’t think your code is wrong but the editor is not aware of the custom field you made and gives an error because of that. Try to ignore the editor and test the page anyway to see if the values end up properly in your custom field at registration.

Thank you for the reply.

Tried ignoring the editor’s error but it does not work.
The code just gets stuck on the line and does not execute further.

Did you first follow the procedure for adding custom fields? See Adding Custom Fields to Contacts .

Hi Yisrael,

Yes - See attached image.

One other thing, you shouldn’t be converting a String to a String.

You don’t want this:

"dealerRequest" : String($w('#textBoxProof').value);

You want this:

"dealerRequest" : $w('#textBoxProof').value;

If you are still encountering issues with this, please post the URL of your site and explain where to find this and how to reproduce the problem.

I removed the String but it did not make any difference.
How do I privately share the URL of the site and explain where to find this and how to reproduce the problem?

@oren Just post the Editor URL of your site as no one outside of Wix can open your site in the Editor. Explain how and where to see the problem.

Hi, I have the same issue. Was this issue resolved?

Did anyone resolve this issues smh

Bumping-up old posts is perhaps not the best idea and i will also provide you a good example → why you should do this…

This post is talking about CUSTOM-FIELDS !?! What are CUSTOM-FIELDS?
Try to find → CUSTOM-FIELDS inside the VELO-API-DOCS, are you able to find them ?

I bet you won’t be able to find anything about → CUSTOM-FIELDS in the VELO-API-DOCs anymore → because this API is outdated and DEPRICATED.

The new API for your wished functionality is called → extended fields <—

On 29-th of june, perhaps the old API still existed, but it is almost 2022 and time is changing and with the time also the world of VELO changes to.

This is one of the reasons why you shouldn’t bump-up old posts.
Feel free to open your own new post, with your own good described issue-description.

BTW: This could be the right API → you were searching for…
https://www.wix.com/velo/reference/wix-crm-backend/contacts/findorcreateextendedfield

This is a very arrogant and unhelpful reply.

Here is a link to the register() function.

Even with the new Authentication API, “CUSTOM-FIELDS !?!”… are still used in the same way as described in oren’s original question and errors do still appear.
@lv2lrn4lf & @kayvon-shahir , in answer to your questions, While errors do appear in the code, if you have added the custom field to your contacts, it should still work.

authentication . register ( email , password , {
“contactInfo” : {
“firstName” : firstName ,
“lastName” : lastName ,
“picture” : image ,
“Member Type” : type
}

If you are still having trouble, share your code. I’d be happy to see if we can solve your troubles .

Im definitelly no pro but in the original question by oren, would the rogue semi-colon be an issue?

“dealerRequest” : $w(’ #textBoxProof ').value ;

*on a similar note, here’s a link that I found helpful when trying to use a wix image to register a user:

Giri’s answer helped me.

I’m also having issues with this. I cannot find any info on it on the web.

authentication . register ( email ,  password , { 
        contactInfo : { 
            "firstName" :  firstName , 
            "lastName" :  lastName , 
            "customFields" : {  "Role" :  role ,  "Industry" :  industry  } 
        } 
    }) 

I have two custom fields in my contacts/members named “role” and “industry” (capitalization is correct). But I get this error regardless of whether I put the code in the front-end or the back-end.

I tried ignoring the editor’s error but the execution halts at this line. Things crash in published site.

Any feedback would be great.

Good day - “Company” is a standard member field yet does not appear as a selectable field when building out the Custom Member Sign Up Form. Grateful for any insight you could share!

Please open your own post and describe your issue as most detailed as possible.

Thanks @russian-dima , I have opened a new post.

I figured out what my problem was. Even though the field name is Role and Industry, I needed to use small letter fields in the code because the field names are “role” and “industry”. This isn’t obvious as it’s not shown anywhere.

1 Like