Advanced Name Triggers

Easily extend your Slapforms with Name Triggers to fire webhooks, control email behavior, and much more.

What are Name Triggers

Name Triggers always begin with slap_ and then are followed by the trigger name, such as slap_debug which enables some debugging features for your form. Name Triggers usually don't show up on response emails but they do affect how the responses are processed.

Slapform Name Triggers can be used in 3 different ways and they will all mostly function in a similar fashion:

  1. As a name attribute on an HTML <input>.
  2. Inside the data object of an AJAX request.
  3. In the query string of the action attribute on an HTML form.

Name Trigger List

Name Trigger Minimum Plan Form Type Type Default Value Definition
slap_email All plans HTML, AJAX string null An alternative for appending your email to the action attribute on an HTML form or the url field in an AJAX request.
slap_request All plans HTML, AJAX string Determined by Slapform Normally, Slapform will intelligently attempt to determine your request type. This is important because AJAX requests are handled differently than HTML form submissions, and each request type has different features. However, you can override what Slapform determines by using this name trigger. If you do supply this, it must be either ajax or form.
slap_form_id All plans HTML, AJAX string 0 Every unique URL that hosts a Slapform will get a uniquely generated ID looking something like this: form_1aa12345-1abc-1234-c456-d1234567890e-XXXX where the XXXX is equal to the value of slap_form_id. This comes in handy if you have multiple Slapforms on one page or otherwise want a way to identify your Slapforms in a human-readable, predictable way.
slap_debug All plans HTML, AJAX boolean false Enables debugging features. The submission page will show the response from our server ( see an example ).
slap_honey All plans HTML, AJAX string null A honeypot for spam. This Name Trigger works best as a hidden <input> field. Now if a bot tries to fill out your form, the submission will be discarded.
slap_replyto All plans HTML, AJAX string [email protected] Change the reply-to address of the submission email you receive. The default reply-to address is ours, [email protected], but you can make it whatever you want with this Name Trigger. This Name Trigger will show up in the response email data.
slap_subject All plans HTML, AJAX string New Slapform Submission Change the subject of the submission email you receive.
slap_redirect Apprentice HTML string https://slapform.com/submission Change the destination of the "thank-you" page after an HTML submission. By default, your HTML forms will redirect to our standard thank you page. This Name Trigger has no effect on AJAX submissions because it's impossible for an AJAX response to redirect. You can, of course, do a redirect yourself with window.location.href when the AJAX response is received!
slap_webhook Sumo HTML, AJAX string null Forwards the submission to a webhook endpoint. This makes Slapform compatible with virtually any other service, such as Zapier.
slap_captcha Sumo HTML boolean true Use this to enable or disable the captcha. It's a good idea to leave the captcha enabled, but if you want your users to have a quicker experience, don't hesitate to disable it! This trigger has no effect on AJAX submissions.

HTML Example using Name Triggers

Below is a "kitchen-sink" example utilizing all of the available Name Triggers. Copy and paste and customize to your needs!

    
      <form method="POST"
        action="https://api.slapform.com/[email protected]">
        <input type="text" name="name">
        <input type="email" name="slap_replyto">
        <input type="text" name="slap_subject">
        <textarea type="text" name="message"></textarea>
        <input type="text" name="slap_debug" value="false" hidden>
        <input type="text" name="slap_honey" hidden>
        <input type="text" name="slap_redirect" value="https://yourwebsite.com" hidden>
        <input type="text" name="slap_webhook" value="https://yourwebsite.com/webhook" hidden>
        <button type="submit">Submit</button>
      </form>
    
  

Don't forget that you can combine the use of Name Triggers in form name attributes as well as the query string in the action attribute of the form. Here is the exact same example utilizing this feature.

    
      <form method="POST"
        action="https://api.slapform.com/[email protected]&slap_debug=false&slap_redirect=https://yourwebsite.com&slap_webhook=https://yourwebsite.com/webhook">
        <input type="text" name="name">
        <input type="email" name="slap_replyto">
        <input type="text" name="slap_subject">
        <textarea type="text" name="message"></textarea>
        <input type="text" name="slap_honey" hidden>
        <button type="submit">Submit</button>
      </form>
    
  

Pro Tip

It's generally a great idea to use the form inputs for user input and the query string for things set by you (the developer). The example above exemplifies this.

AJAX Example using Name Triggers

Below is a "kitchen-sink" example utilizing all of the available Name Triggers. Copy and paste and customize to your needs!

    
      <script
      src="https://code.jquery.com/jquery-3.2.1.min.js"
      integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
      crossorigin="anonymous"></script>

      <script type="text/javascript">
        $( document ).ready(function() {
          $.ajax({
            url: 'https://api.slapform.com/[email protected]',
            dataType: 'json',
            type: 'POST',
            data: {
              name: 'Jon Snow',
              message: 'Hello World! This is my first Slapform submission.',
              slap_subject: 'My Favorite Message',
              slap_replyto: '[email protected]'
              slap_debug: false,
              slap_webhook: 'https://yourwebsite.com/webhook',
              slap_honey: ''
              /* These Slapform Name Triggers exist but aren't applicable to AJAX submissions */
              // slap_redirect: 'https://yourwebsite.com',
              // slap_captcha: false,

            },
            success: function (response) {
              console.log('Got data: ', response);
              if (response.meta.status == 'success') {
                console.log('Submission was successful!');
              } else if (response.meta.status == 'fail') {
                console.log('Submission failed with these errors: ', response.meta.errors);
              }
            }
          });
        });
      </script>
    
  
× You are using an outdated browser that our site DOES NOT support. Please click here to update your browser.