Customize the Form
Last updated
Last updated
You can now customize the form from Cotter's Dashboard > Branding.
Customizable Features that are not available in the Dashboard:
You can use our advanced config to have more functionality:
Here's an example of a complete configuration:
Field Name | Description | Required |
ApiKeyID | your | Y |
The backend URL where we will send a JSON obj containing form information and a token | Y | |
Type |
| Y |
ContainerID |
| Y |
ButtonBackgroundColor | Button background color. Use HEX format (e.g. | N |
ButtonTextColor | Button text color. Use HEX format (e.g. | N |
ButtonText | Button text. Default is "Sign Up Without Password" | N |
Additional fields that you want to include in the JSON obj. Check the specs for Additional Fields Object below | N | |
IdentifierField | Field name for the identifier to include in the JSON obj. For example, if you want to include the phone number in the JSON obj under key | Y |
A function that will be called before the signup process begin. Check the specs for OnBegin below | N | |
A function that will be called when the signup process succeed. It's recommended to set your localStorage/cookies here and redirect to your dashboard. Check the specs for OnSuccess below | Y | |
An Array of country code options for the user | N | |
PhoneChannels | An Array of channels to send verification code to your users. Default value is | N |
We will send a JSON Object to this backend URL. The JSON Object will have the following format:
Description:
payload.Token
Contains the email or phone number of the user. You should verify the signature to ensure that the request comes from Cotter's server.
payload.IdentifierField
This field name will be the same as what you specify in the config
above. For example, if your IdentifierField = "PHONE"
, you'll get
payload.AdditionalFields
The rest will be filled with any additional fields you specify in the config
. For example if you add fields for "name"
and "address"
, you'll get:
Read how to specify Additional Fields Object below.
If you want to handle Cotter's token in a function instead of sending it to your backend redirect_url
, you can specify
When this is true, the JSON payload as specified in RedirectURL section will be passed into your OnSuccess function.
The additional fields will be used to generate more <input>
fields for your users. The format is as following:
Available types:
hidden
,text
,number
This will be sent to you to the RedirectURL endpoint above as part of the JSON object. For example, with the fields above, you'll get a JSON object like the following.
JSON Object to be sent to RedirectURL
:
This function will be invoked before the Signup/Login process. You will receive the following payload as a parameter to your function
Payload passed into your OnBegin function
You can do a check against the identifier
here before the form is submitted.
If you include OnBegin
key, you have to either return an error string, or return null if you want to continue the authentication process:
A. If you want to continue submission:
B. If you want to stop submission with an error:
Example:
This function will be called after the call to RedirectURL
is successful. Your function will receive the payload returned from RedirectURL
.
It is recommended to set your sessions or cookies here, and then redirect to another page in your website. For example:
OnSuccess when SkipRedirectURL is true
When you set SkipRedirectURL: true
, OnSuccess
will instead receive the JSON Payload token that was described in RedirectURL section.
The default value is CountryCode: ["+1"];
If you specify this, you have to use an array even though you only need 1 country code!
ex. with 1 country code
ex. with 2 country codes
Currently, the only available countries are United States, India and Indonesia. Chat us on Intercom if you need other countries, we just need to switch it on.