← index

CreateTagOnSubmit

Name: CreateTagOnSubmit
Version: 1.0
Status: Unstable POST returns 404 because of OPTIONS preflight check. Works in Postman, but not through jQuery. cross-origin-request error.
Description: Creates and injects a tag into the desired contact.
Author: Grant Kimball
Company: Outreach, Inc.
Dependencies: jQuery

create-tag-on-submit.js usage


Installation

jQuery is a dependency. Make sure it is loaded in your page, then include this just above the closing </body> tag.

<script type="text/javascript" src="path/to/file/create-tag-on-submit.js"></script>

Then replace form's submit button with <button type="button" class="createTagOnSubmit">Submit</button>

Form Requirements

USAGE

    <form name="demoForm" method="post" action="">
        <input type="email" name="contact[email]" placeholder="email" />
        <input type="text"  name="contact[first_name]" placeholder="first name" />
        <input type="text" name="custom_fields[op_org_name]" value="MYDynamicOrg" />
        <input type="hidden" name="returnURL" value="http://google.com" />
        <input type="hidden" name="listID" value="45575" />
        <input type="text" name="tag[name]" placeholder="tag" />
        <button type="button" class="createTagOnSubmit">Submit</button>
    </form>