Very Simple Submission Approval for Gravity Forms

Provide a very simple, single-step approval process for your Gravity Forms submissions.

May 14th, 2015: Updated snippet to support ".hide-in-approval-mode" CSS class. Allows for hiding of fields that should not be visible to approving user.

Special thanks to Derek Leek for the original idea and commissioning this solution!

In this tutorial, we’re going to walk through the creation of an approval process for a prayer request form. The user can submit a request for themselves or for a friend. If requesting for a friend, we will require that the friend approves the request. Here’s the basic workflow:

  1. User submits prayer request form for a friend.
  2. Approval request notification is sent to the friend’s email address (provided in the form) which includes a link to form with the request form data loaded.
  3. The friend access the approval link, views the request, and approves it (or not).

So how does this sort of an approval process work? Most of it is handled by Gravity Forms new Save and Continue functionality. It’s not exactly intended for use as an approval system but… we’re going to get some really good mileage out of it.

Before we go any further, I want to stress that this system is very basic. It’s a quick and easy way to do a single-step approval process. If you need something more advanced, I’d recommend checking out Gravity Forms developer Steve Henty’s tutorial and upcoming plugin here.

The pros of this workflow?

  • very simple approval process making it easy to use and modify to fit your needs
  • only requires the approver’s email (does not have to be a user on your site)
  • primarily uses default Gravity Forms functionality (with some enhancements via custom code) for the entire approval process

The cons of this workflow?

  • very simple; if you need a more robust solution, this is not for you
  • there is no visibility of saved submissions that are never approved
  • there is no rejection of a saved submission; the approver either approves it or does nothing

Alright, let’s get started.

1. Setup our Fields

  1. gw-simple-approval-is-approval-field-advanced
    Add a Hidden field and set the dynamic population parameter to “is_approval”.

    • When the approver accesses the form via the Approval URL, this field will automatically be populated with a value of “1”. We will call this scenario “Approval Mode”.

    What is “Approval Mode”?

    The snippet (which you’ll be installing shortly) appends a new parameter is_approval to the Save and Continue URL. This URL is then sent to the approver’s email address. When the approver clicks this link, the parameter will be populated into a Hidden field on the form (you’re about to add that field shortly as well).

    We can then base conditional logic rules on the value of this field. If the Hidden field is “1”, we’re in “Approval Mode” and we can hide fields that should not visible to the approver.

  2. gw-simple-approval-conditional-field-advanced
    Add a Radio Buttons field to indicate whether the prayer request is for the submitting user or a friend.

    • User conditional logic to hide this field if the form is in Approval Mode.
  3. gw-simple-approval-email-field-advanced
    Add an Email field for the friend’s email address.

    • Use conditional logic to only show this field if the prayer request is for a friend and the form is not loaded in Approval Mode.
  4. gw-simple-approval-request-field-general
    Add a Paragraph Text field for the prayer request content.

2. Configure the Form Settings

  1. gw-simple-approval-form-settings
    Enable Conditional Logic on the Submit for approval button. Show the Submit for approval button if:

    • The request is for the user submitting the form.
    • Or if the form is loaded in Approval mode.
  2. gw-simple-approval-form-settings
    Enable Save and Continue.

    • Update the “Link text” setting to read “Request Approval”.

3. Confirmations

The Confirmations are used to keep users informed that whatever action they have performed was completed successfully. A user submitting a request for themselves should see a confirmation stating that their submission was successful. A user submitting an approval request for a friend should see a confirmation stating that their friend has been notified of their pending request. A user approving a request should see a confirmation stating that the request was successfully approved.

gw-simple-approval-confirmations
  1. The Default Confirmation will be presented if no approval is required i.e. there’s no need for an approval process. In this case, that means the submitting user is making a prayer request for themselves.
  2. gw-simple-approval-save-and-continue-confirmation
    The “Save and Continue Confirmation” (which is added automatically when you enable Save and Continue) will be presented when approval is requested. This lets the submitting user know that the approving user has been notified.
  3. You can safely ignore the “Save and Continue Email Sent Confirmation”. This confirmation will not be used in our configuration.
  4. gw-simple-approval-request-approved-confirmation
    Create a new confirmation which will be presented when a request has been approved. This means the form has been submitted while in Approval Mode.

    • Make sure you enable conditional logic on this confirmation and set the condition such that this confirmation will only be used when Approval Mode is active.

4. Notifications

There is only a single notification required. This notification will be used to notify the approver that there is a request pending their approval and also provide them a link to that request.

gw-simple-approval-notifications
  1. You can safely ignore the “Save and Continue Email”. This notification will not be used in our configuration.
  2. gw-simple-approval-request-approval-notification
    Create a new notification which will be sent to the approver requesting approval and providing the approval link.

    • Set “Event” to “Form is saved”
    • Set the “Send To” setting to “Select a Field” and the “Send To Field” to the Email field we added in Step 3.3
    • The “Subject” and “Message” should indicate that approval is required.
    • The “Message” should include the {save_link} merge tag which will provide the Approval URL to the approving user.

5. Install the Snippet

The snippet is the glue that pulls all the pieces together and adds a little polish to the system to make it feel more intentional (you’ll find it at the top of the page). What does it do exactly?

  • Adds the “is_approval” query parameter to the Save and Continue link.
  • Populates the “is_approval” value into the designated field (set dynamic population parameter to “is_approval”) when the form is loaded in Approval mode.
  • Sets fields to “readonly” if option is enabled.
  • Updates Submit button label when the form is loaded in Approval mode.
  • Styles the “Save and Continue” link (which is our Approval Request link) as a submit button.
  • Handles hiding the Save and Continue link when the Submit Button is visible and vice versa.

Installation Instructions

  1. Make sure Gravity Forms is installed and active.
    Need a license? Buy Gravity Forms
  2. Copy and paste the entire snippet into your theme’s functions.php file.
    Having trouble installing the snippet?.
  3. At a minimum you will want to set the the “form_id” parameter to the ID of your form. There are a few other options as well.

Parameters

  • form_id (int) (required)

    Specify which form (by ID) to which this functionality should apply.

  • approve_button_label (string) (optional)

    Specify a label that will replace the default Submit button label (the approval button) when the form is loaded in Approval Mode. Defaults to 'Approve'.

  • approval_read_only (bool) (optional)

    If GP Read Only is active and this parameter is set to true, all fields will be read-only when the form is loaded in Approval Mode. A handy way to allow the user to see the submission but not modify it. Defaults to false.

    Speaking of Save & Continue: if you utilize Save and Continue functionality elsewhere, you may find Gravity Forms Advanced Save and Continue useful. This plugin builds on core Save and Continue functionality, adding the ability to automatically save form progress, reload that progress when you return, manage multiple drafts, and it works for both logged-in users or any website visitor.

Is this something you’ll use?

We hope so! As always, happy to answer approval process related questions in the comments and we absolutely love seeing examples of our snippets used in the wild.

Comments

  1. Seth
    Seth July 25, 2021 at 6:13 pm

    This is fantastic, thank you!

    One question: If I invite people to upload an image (using the Upload Multiple Files option an limiting it to one; the single file upload function doesn’t work), I can approve their photo before submission, except for one thing — I can’t actually view the image.

    Any thoughts on how to view the submitted image before approving the form submission?

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff July 26, 2021 at 12:08 pm

      Hi Seth,

      Save & Continue feature has not yet been fully implemented in the GP File Upload Pro, so unfortunately the Image Preview won’t be able when approving the form and we also don’t have a workaround solution for this.

      Best,

  2. Rose
    Rose May 25, 2021 at 11:43 am

    This works great! I do have some fields that must be filled out before being submitted for approval, however, it’s still being submitted when the required fields are not filled out. Is there a way to fix this? I would like the required fields to be fill out before being submitted for approval.

    Thanks!

    Reply
  3. Ty
    Ty April 11, 2021 at 8:26 am

    Looking to see what part of the snippet where the user does not have to be logged in to make the approval. At the moment everything works but when the approval email is sent the person gets a 404 error page because they’re not logged in as a user. Any help would be much appreciated. thank you.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff April 12, 2021 at 8:49 am

      Hi Ty,

      A non-logged-in user should be able to access the form using the link sent via the approval email. You may want to check if you have any settings on the form restricting it to only logged-in users. However, in case you’re a Gravity Perks subscriber, you can write to us via our support form so we can look into this further.

      Best,

  4. Drs. Andor Demarteau
    Drs. Andor Demarteau August 17, 2019 at 2:30 pm

    David, Interesting snippet, very useful for a quick subscription confirmation form. However, I’m running into two issues: – the text set at the bottom of the script is not replacing the text on the “save and continue” button – I have set “is_approval” as stated, however this seems to fail as well. (used a number field for this) Any suggestions?

    Reply
    1. Drs. Andor Demarteau
      Drs. Andor Demarteau August 17, 2019 at 2:44 pm

      update: it seems the number field isn’t handling the is_approval=1 setting very well. A text-line element will work though. Remains the button text to be solved.

    2. Drs. Andor Demarteau
      Drs. Andor Demarteau August 17, 2019 at 2:55 pm

      update 2: the is_request parameter is also added to the URL when submitting the form. Interestingly it is reading is_approval=2

    3. Drs. Andor Demarteau
      Drs. Andor Demarteau August 17, 2019 at 3:09 pm

      update 3: need to learn to read :) Missed the fact the text is not for the “save and continue” but the “submit” button.

      This however leads to two questions: – how can I change the text on the “Save and continue” button? (the form settings itself seems to have no option for this) – I’ve already set the text for the submit button in the settings of the form, which one gets precedence over which between form settings and snippet code?

  5. Danny
    Danny July 24, 2018 at 10:49 am

    I was wondering if anybody knows of a way to set up “Yes” “No” Buttons in an email notification that will “approve” or “deny” entries in gravity forms. The blog post comments give this option, but I am hoping I can figure this out for the email notifications of gravity form entries so the moderator of these approvals has the ability to do them straight from the email instead of logging in to view the entry

    Reply
  6. Kurt
    Kurt February 15, 2017 at 11:08 pm

    Hi David,

    Is there anyway to to have multiple forms using this approval request method?

    Form 1 will provide the correct Approval button but Form 2 does not seem to work as it will just be a hyperlink and not a button unlike form 1. ( This is how I have the code laid out below)

    Also What is the best way to customize the color etc of this approval button?

    Thanks in Advance

    Reply
    1. David Smith
      David Smith Staff February 16, 2017 at 10:38 pm

      Hi Kurt, this only supports a single form approval flow. Check out Gravity Flow for more advanced approval workflows. CSS is the best way to customize the approval button.

    1. Tim
      Tim November 11, 2016 at 12:12 pm

      Hi David – since it’s basically Save and Continue, could I create the notification to include the user’s email after it’s “approved”? Does that make sense?

    2. David Smith
      David Smith Staff November 12, 2016 at 12:36 pm

      I didn’t think of that but yes, since you are saving all the data in the final entry, you could send a notification to the original submitter by creating a notification for it bound to the form submission notification event.

    3. Tim
      Tim November 14, 2016 at 8:48 am

      Hi David – sounds good. In that case, can I also add an APPROVE or DENY radio button on that last page? That way, the user can know if it was approved or denied (not a prayer request, haha! Just time off).

    4. David Smith
      David Smith Staff November 14, 2016 at 9:21 am

      This doesn’t really offer a method for denying requests other than simply not approving it. Since there is no event for non-approved requests, I’m not sure you’d be able to send a notification.

      It sounds like you’re looking for a more polished solution. Check out Gravity Flow.

  7. Dennis
    Dennis September 20, 2016 at 6:53 am

    David,

    thank you very much. I got the GV from Github (so no support), I am just testing it, trying to figure out if it will fit my needs… But thanks for coming back anyway, good to know.

    Reply
  8. Dennis
    Dennis September 19, 2016 at 9:57 am

    That’s a really nice feature. I have been playing with gravityview and gravity forms last days and I am really excited about the functions of those two plugins. I have been looking for a nice theme or even plugin for a directory. Bought already 2 Themes on envato (awaiting refund :/ right now because of too many bugs) and hoping to be able to build the right stuff with gravityview and forms. The problem I’ve got is that all the submissions that I make are automatically approved and appearing directly on the site. So do I have to change this upfront to get this prayer stuff running? Thanks!

    Reply
    1. Dennis
      Dennis September 19, 2016 at 2:19 pm

      Hi David,

      so – when I submit a submission with gravity forms – the entries are automatically approved as you will see on the screenshot, but they shouldn’t. How can I change it? http://imgur.com/dVHuPt2 I marked one as “not approved” manually. I would like to have them all as “not approved” by default after submitting, so I can review them and approve etc.

    2. David Smith
      David Smith Staff September 19, 2016 at 10:28 pm

      Ah, this does not work with Gravity Views Approval field. You might consider reaching out to GV support for this one.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.