Registration Form Developer Guide
If you are reading this, you must be the lucky person in charge of implementing the Spark registration form for this project! Depending on your client's specifications, you may be writing most of this form from scratch, but there are a few things we need you to keep in mind to ensure the form data submits to us successfully.
The first thing you'll need is the raw form code. If you don't have access to the project on Spark, and your client has not yet provided you with this, please get in touch with them and either request that they add you as a Web Developer to the project, or have them send you the code. If you already have access to the project, you can find the code under Embed Options in each form's micro menu.
The key things that you must not change about this code are the form tags - it must POST to the url specified in the 'action' attribute - and the 'name' attributes on any of the form field tags. You can remove as many fields as you like ("contact[email]" is the only one strictly necessary for a successful submission), change the labels and aesthetically restructure it in any way you please, but those two things must stay the same.
Example Form Tag
<form accept-charset="UTF-8" action="https://spark.re/your-company/your-project/register/form-id" id="register-form" method="post">
Example Input Tag
<input id="contact_email" name="contact[email]" type="email" />
You need to tell us where to send the user after they have successfully (or unsuccessfully) submitted the form. Most of our clients will build a simple 'Thank You' page as their redirect_success, and use the url of the page where you are hosting the form as the redirect_error. Enter these urls as the value for the hidden inputs as below.
<input id="redirect_success" name="redirect_success" type="hidden" value="http://yourproject.com/your_thank_you_page.html" /> <input id="redirect_error" name="redirect_error" type="hidden" value="http://yourproject.come/register_link" />
We do not post any of the data back to the redirect error url. To avoid contacts filling out a long form, only to be redirected to an empty one after an unsuccessful submission, we provide basic validation for Email and any other required fields. Any further validation would need to be added on your end.
Spam and Recaptcha
If, however, your page gets targeted by a more clever spambot, you may need to implement a more robust solution. Spark also provides support for Recaptcha. When you register for the Recaptcha API, you will receive a pair of keys - Implement the captcha as per their Developer's Guide, and then supply your client with the Secret key, which they will need to enter in their Recaptcha Setup (under Forms > Registration Forms) on Spark.
Some clients will choose to use the agent field in their form. This is a special field that, if checked, will assign this registrant an "Agent" rating on Spark. If your client requests an alternative format for this question (ie: Yes/No radio buttons, or a select tag), please ensure that the alternative options submit null/empty values for this field.
<input id="agent", name="agent", type="checkbox", value="true">
<select id="agent", name="agent"> <option value> No </option> <option value="true"> Yes </option> </select>
This field can be used if your client would like to specify a custom source for their incoming registrants, and may already be set if the client has completed the form settings in advance. For example, if you are hosting the form on multiple websites, you can declare a unique source on each form so that the client can identify on Spark which site the contact has registered from.
If this option is excluded, Spark will set the source as 'Registration Form'.
<input id="source" name="source" type="hidden" value="Registration Form">
If you prefer, you can include a 'full_name' field in your form instead of using separate first name and last name inputs. When the form is submitted to Spark, we will split the value of the full_name field on the first space to populate first and last name. Be aware that this may result in a few odd entries in the unusual event that a registrant provides multiple first names or middle names.
<input id="contact_full_name" name="contact[full_name]" type="text">
With those things in mind, the rest of the job is up to you! For any further technical inquiries relating to Spark, feel free to contact our tech team at firstname.lastname@example.org.