Registrations - Creating

This outlines how to correctly pass a registration over to a Kindful registration form so the registration can be successfully created in Kindful. A common example is allowing users to sign up for an email newsletter.


Sample Email Sign up Form

Add and edit this HTML and Javascript to your website to have people sign up for e-mails on your site:

HTML

COPY
<div class="email-form">
	<input id="first_name" name="first_name" placeholder="First Name" />
	<input id="last_name" name="last_name" placeholder="Last Name" />
	<input id="email" name="email" placeholder="Email" />
</div>

Javascript

COPY
var registration_form_id = __________________ 
//your registration form id from Kindful

var registrationUrl = "https://testorganization.kindful.com/registration_widget?" +
"&registration[registration_form_id]=" + registration_form_id +
"&person_attributes[first_name]=" + encodeURIComponent($('input[name="first_name"]').val()) +
"&person_attributes[last_name]=" + encodeURIComponent($('input[name="last_name"]').val()) +
"&person_attributes[email]="+ encodeURIComponent($('input[name="email"]').val()) + "&success_url=" + encodeURIComponent('http://testorganization.org');

$.ajax({
  type: "GET",
  dataType: 'jsonp',
  url: registrationUrl,
  context: document.body,
  success: function(data){
  	if (data["success"] == "true") {
      #whatever logic you'd like to show now that they've successfully signed up.
  		$('.email-form').html('Thank you for signing up!');
  	} else {
  		alert(data["message"])
  	}
  }
})

Creating a Registration Form

Every organization in Kindful has admin accounts. If you are admin, follow the steps below or find an admin to do so:

  1. Sign into your admin account
  2. Navigate to ‘/admin/registrationforms’ and create a new form (ie: first name, lastname, email).
  3. When you are editing the form, your registration form id is the last part of the url: ‘/admin/registration_forms/your-id-number-is-here’.

Creating a Registration

API GET '/registration_widget.json'

Example: ‘https://organization-subdomain.kindful.com/registration_widget.json’

NOTE

AJAX request should be of the dataType ‘jsonp’.


Required Params

Parameter Description Required
registration[registration_form_id] value should be the registration_form_id of the form you’re creating a registration for yes
person_attributes[first_name] value should be the first name of the registrant (needs to be encoded) yes
person_attributes[last_name] value should be the last name of the registrant (needs to be encoded) yes
person_attributes[email] value should be the last name of the registrant (needs to be encoded) yes
success_url url to redirect browser too. (needs to be encoded) yes

Some Optional Params

Please note that these fields must be set up on the registration form itself in order for them to be saved. All values must be encoded.

Parameter Description
person_attributes[address]
person_attributes[city]
person_attributes[state]
person_attributes[postal_code]
person_attributes[country]
person_attributes[birthday]
person_attributes[phone]
success_url
callback url to redirect browser too. (needs to be encoded)

Response

If successful, you'll get a response of:

Successful Response

COPY
{
  "success": true,
  "success_url": "http://example.com (this will be whatever you passed in)"
}

If registration is unsuccessful, you'll get a response of:

Unsuccessful Response

COPY
{
  "success": false,
  "message": "Corresponding error message will display here, ie: A registration with this email address has already been created"
}