SOLVED - Unknown Failure 404 on Custom User Registration

#404 #failure #customRegistration #wixUsers

Hi guys,

I’m trying to setup a custom registration form and I end up getting an unknown failure (404) error whenever I submit the form (Both Preview and Live Modes)

This is the Dev panel :

This is my code :

function createMember() {

 let label = "Seller";

  wixUsers.register($w("#email").value, $w("#password").value, {
 "contactInfo": {
 "firstName": $w("#firstName").value,
 "lastName": $w("#lastName").value,
 "agencyName": $w("#agency").value,
 "labels": label
    }
  } )
  .then( (result) => {
 let status = result.status;
      reDirect(status);
  } )
  .catch( (err) => {
    console.log(err);
     $w("#signUpError").show();
  } );
}

This is my Custom Field:

These are my labels:

Am I doing something wrong or is this a bug?

-Shan

1 Like

anyone?

what happens when you remove

"labels": label

It does go through but the Custom Field Agency Name gets nothing

wixUsers.register($w("#email").value, $w("#password").value, {
 "contactInfo": {
 "firstName": $w("#firstName").value,
 "lastName": $w("#lastName").value,
 "agencyName": $w("#agency").value
    }
  } )

@shantanukumar847
ok getting a bit closer…Have you checked that you have the correct fieldKey and the correct input ID for agency ?

I never edited the column so the input ID should be " agencyName " and that’s what I have on my Page Code.

I tried making another Custom Field with the same name and I get an error, so I believe the above Field Key should be correct.

"agencyName": $w("#agency").value

$w(“agency”).value is correct because I’m saving this info into a database after creating a member profile and its inserting correctly.

@shantanukumar847
Create a new field name in the the CRM and call it “agencyName2”

then…

"agencyName2": $w("#agency").value

@mikemoynihan99

Thank you Mike, It works

I suppose there is no work around for the ’ labels ’ issue too?

Is there a FB or Google My Business Page where I can leave a Good Review for your time?

Thanks a lot,

Shan

@shantanukumar847
ok so the agency issue was being caused as you did not have the correct field key, WIX CRM does not show you the correct field key when you use a space between names…they should fix that.

For labels you need to create a fieldKey called labels then you will be able to pass info to it. Note this will be a custom fieldKey not a label.

@mikemoynihan99

I understand

Thank you

Hi Shan,

I believe I discovered the issue in your code regarding the label not being added. When you add labels via the wixUsers.register() API, it requires that you add them as an array . This allows you to add multiple labels, but even if you’re only adding one, it still needs to be in an array.

So your variable assignment should be:

let label = ["Seller"];

When I tried it using your code, I received a 400 error. Once I converted it to an array, it worked fine.

I admit it should handle this more gracefully, particularly because the error is not very specific. I’ll speak to the developers about this.

Anyway, please give this a try and let us know if that fixes the problem. Good luck!

Oh, I just noticed in the Wix Code Tutorial article on adding a custom registration form that the code places the square brackets inside the contactInfo object. It doesn’t matter which way you do it as long as you’re passing an array to the ‘labels’ key in the contactInfo object. HTH.

It does work when I pass labels as an array.

Thank you Chaim

FYI I worked with one of our technical writers and he changed the example to make this all clearer, so hopefully no one else will be tripped up by it. Sorry for the trouble!

That’s great news!

Thank you for taking out the time to rectify it