Hello everyone.
I found an issue trying to use the wix-members.authentication API. I tried to use the register function with customFields and found not a way to make it work.
Context.
I have already created the custom fields in the wix dashboard for my members.
Custom signup is enabled.
The documentation says this about the custom fields.
And I tried implement it in a custom sign up form I made.
As you can see, the “customFields” field do not accept the key:value pair. Here is the error message that shows on hover.
When I try to type just a simple string not error is shown.
Which does not seem to make sense to me because in the documentation says to add key:value pairs.
I am not an expert, please correct me if I am getting this wrong.
PS: Also, I cannot find a way to see the keys of my custom fields. Look. I filled those fields in the dashboard and made a request with getMember().
I even tried to use that structure and names but it does not work neither.
I would appreciate your help!
Hello. To add data to the custom field you created in the backend, you would need to target it by the name itself. Scroll through this example where it shows the code for how to add height input as a custom field and let me know if that works out for you.
The code expects the custom field to be formatted as a string, however it looks like you are trying to pass it as a JSON object. You can just call JSON.stringify on the value. When accessing it later you can call JSON.parse to convert it back to the expected value.
Hi @amanda and @amotor . You are right. I figured that out the day after I placed this post. It was weird because up until now the code editor shows an error on my custom fields (even though they are saved when excecuting the code). It is probably just a bug, but it would be nice to check that out because I lost many hours trying to understand the error to finally realize I needed to ignore it.
Thanks for replying! I will mark your replies as accepted answers.