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.

Build and submit a form invisibly with submit event outside of form

  1. Hi

    This is a weird one, granted, I want to know if there's a way of submitting a form based on an action of something else on the screen. I'll try to detail it....

    1) A user on my site clicks a button to download a voucher. I call a Gravity Form first, to capture their details. On submission I set a session variable, and the user is able to download their voucher.

    2) Within this session I the user wants to download another voucher. Rather than ask them to fill in a form again, I build a form invisibly on the page, and populate it using my stored session variables.

    The bit I can't do...

    3) On clicking to download this second voucher, the form is sent and I log the details in the gravity forms database.

    I've searched around, but I can't find any pointers on this. Can it even be done?

    Many thanks in advance

    Posted 12 years ago on Thursday November 22, 2012 | Permalink
  2. I've figured out that the best way to do this is to write directly to the database table, which is what I've done and made work. I'd like to know if the solution I was originally after will work or not.

    Posted 12 years ago on Friday November 23, 2012 | Permalink
  3. David Peralty

    I have been puzzling over it since I saw your original message, and I can't think of any way of doing that. It probably could be done, but would need some extensive customization to make happen. I mean, the user should be able to submit a form as many times as they want, so I guess I don't really understand the issue, except for the building/hiding a form.

    All my best.

    Posted 12 years ago on Friday November 23, 2012 | Permalink
  4. Thanks Dave. Yes it is a bit odd. We were looking to find a way of logging details of each download, but without pestering the user each time they downloaded a voucher. The capturing of user data was essential to the process.

    We figured that the best way was to write directly into the DB, with some custom PHP script. It basically does the action we are after ( on downloads 2 and above ) so long as the data from download 1 is stored in a session variable.

    We could have built a completely bespoke thing for this, but Gravity Forms so elegantly handled 85% of the journey, we wanted to keep that mechanic and build upon it.

    Posted 12 years ago on Monday November 26, 2012 | Permalink