Form posting sample code

It’s possible to set up a form on your own website that ‘POSTs data’ directly into your Engaging Networks account after a supporter submits information. This means that you control your form or action and Engaging Networks does the work behind the scenes (submitting data, thank you emails, and so on).

When you are creating the form on your site, you will also need to create a Page Builder page that exactly matches the form set up on your site. You’ll then need to use some of that action’s information to enable the ‘form POSTing’ to work.

In page-builder, you can only POST to a single page. If you have a multi-step form you will need to POST all values at once. 

You cannot POST to a page that has Session Validation turned on (you will see a Forbidden error).

How to post from a form to an Engaging Networks page

To do this, you would need to create your Engaging Networks page to post to, as usual. This should be two pages long – the first page should have the form fields on, and the second page should be your thank you page.

Then, you need to create your HTML form in your website (or wherever you want it to be). The form needs to have a method of “post” and an action that is the 2nd, final, page of the Engaging Networks campaign you created. 

Each field needs to have the same name attribute to matches the name attribute of the Engaging Networks page. All supporter record fields have a name that is like supporter.fieldname, and opt-ins and questions supporter.question.ID. To find out the name, inspect the Engaging Networks page. 

Example code 1

Below is some sample code. Once you have set up your form, you will need to adapt this code, updating the names to reflect the real values in your Engaging Networks account. The easiest way to grab these values, is to view the source of the Engaging Networks page in your browser. If you need to add or remove extra form fields, you’ll need to make sure that this code matches up. Always POST to page 2.

<form method='post' action='https://e-activist.com/page/XXXX/data/2'>
  <div class="en__field en__field--text en__field--9703 en__field--firstName en__mandatory">
    <label for="en__field_supporter_firstName" class="en__field__label" style="">First Name</label>
    <div class="en__field__element en__field__element--text">
      <input id="en__field_supporter_firstName" type="text" class="en__field__input en__field__input--text" name="supporter.firstName" value="" />
    </div>
  </div>
  <div class="en__field en__field--text en__field--9702 en__field--lastName en__mandatory">
    <label for="en__field_supporter_lastName" class="en__field__label" style="">Last Name</label>
    <div class="en__field__element en__field__element--text">
      <input id="en__field_supporter_lastName" type="text" class="en__field__input en__field__input--text" name="supporter.lastName" value="" />
    </div>
  </div>
  <div class="en__field en__field--text en__field--9683 en__field--emailAddress en__mandatory">
    <label for="en__field_supporter_emailAddress" class="en__field__label" style="">Email Address</label>
    <div class="en__field__element en__field__element--text">
      <input id="en__field_supporter_emailAddress" type="text" class="en__field__input en__field__input--text" name="supporter.emailAddress" value="" />
    </div>
  </div>
  <div class="en__field en__field--checkbox en__field--question en__field--5850 en__field--opt-in">
    <label class="en__field__label" style="">Opt In</label>
    <div class="en__field__element en__field__element--checkbox" >
      <div class="en__field__item">
        <input id="en__field_supporter_questions_5850" checked type="checkbox" class="en__field__input en__field__input--checkbox" value="Y" name="supporter.questions.5850" />
        <label for="en__field_supporter_questions_5850" class="en__field__label en__field__label--item" >I would like to opt in for future updates</label>
      </div>
    </div>
  </div>
  <input type="submit"/>
</form>

Example code 2

In this example, the form will post to a page with a single email address, but including UTM codes that get recorded in our transactional fields:

<form method='post' action='https://us.e-activist.com/page/XXXX/data/2'>
  <div class="en__field en__field--text en__field--emailAddress en__mandatory">
    <label for="en__field_supporter_emailAddress" class="en__field__label" style="">Email Address</label>
    <div class="en__field__element en__field__element--text">
      <input id="en__field_supporter_emailAddress" type="text" class="en__field__input en__field__input--text" name="supporter.emailAddress" value="" />
    </div>
  </div>
  <input id="en_txn1" type="hidden" name="en_txn1" value="utm_source-goes-here" />
  <input id="en_txn2" type="hidden" name="en_txn2" value="utm_medium-goes-here" />
  <input id="en_txn3" type="hidden" name="en_txn3" value="utm_campaign-goes-here" />
  <input id="en_txn4" type="hidden" name="en_txn4" value="utm_content-goes-here" />
  <input id="en_txn5" type="hidden" name="en_txn5" value="utm_term-goes-here" />
  <input type="submit"/>
</form>

Limits

There is a limit of 200 posts per 5 minutes. If this limit is exceeded an IP block is automatically triggered. If POSTing in batches please limit the rate in your script.

Updated on May 29, 2019

Was this article helpful?

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support