PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Submit form, but don't create entry/send notification unless condition is met?

  1. Hey all,

    I'm trying to sort out how to "retain information" by a user when they are filling out a form and want to comeback to it later to finish. (yes, I know this has been discussed a couple of times, and I know there's a couple of external plugins that are supposed to do this...but I'll explain more on a moment)

    I've got the User Registration add-on installed and activated. It's a long form, and it's meant for a school registration application (lots of questions, and will be using the PayPal Add-On to for registration fee).

    I found the two Add-Ons that are supposed to make this happen, but they require the user be already registered and logged in for them to work.

    For this form, I just want them to submit it, and the usermeta tables will be added with all the info in them.

    The thing is the "coming back and finishing later," which is why I'm asking: is there a way to put a checkbox on the form so the end user could click it, and it'll run the registration stuff (create the user and add all the information put in so far into their usermeta tables) but NOT submit the form as an entry and/or process the PayPal? So the end user could come back and finish by clicking the "Submit" button and everything goes as it should (and the usermeta stuff is updated)? I'm not scared of code - I just didn't know if there was some sort of hook that I could snag onto and make this happen or not? for example, have a button that says "save this stuff" next to the Submit button, so if it's clicked it'll $_POST the info to the usermeta, but not submit the form?

    Posted 10 years ago on Thursday May 30, 2013 | Permalink
  2. Just a thought - I bet gform_pre_send_email is what I'm looking for...

    Posted 10 years ago on Thursday May 30, 2013 | Permalink
  3. I got it!

    1) I used this code so if a user is already logged in, the ability to register will be deactivated (we don't want the end user to be registered *again* if they've already saved the form, and have logged in to finish it.)

    2) I added a checkbox on the form (currently at the top, but I'm hoping to use jQuery to keep it fixed on the side so they can check it at any time - we'll see how that goes. but anyway...).

    3) I two small bits of code to see if the checkbox is checked on submission. If it is, it'll continue processing the form (and saves all the registration fields in the usermeta tables): one bit of code stops the notification email from being sent (with gform_pre_send_email); the second bit deletes the entry completely from the database (with gform_after_submission).

    If the checkbox in #2 is checked, everything in #3 happens. When the end user logs in to finish the form, the form is pre-populated with everything in the usermeta tables in the database. When he wants to officially submit the application, he just has to be sure the box is unchecked when he submits, and everything goes on as normal.

    Hope that helps someone else!

    Posted 10 years ago on Friday May 31, 2013 | Permalink
  4. David Peralty

    Interesting solution. I'm glad you figured out something that works for your needs. All my best!

    Posted 10 years ago on Friday May 31, 2013 | Permalink