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.

Get the entry limit as a variable.

  1. Hello,

    I'm trying to write code to check if the sum of a field in the entries do exceed the entry limit.
    This whole thing should work outside of GF hooks.

    is there a way to get to the variable?

    Thanks.

    Posted 12 years ago on Thursday May 24, 2012 | Permalink
  2. Hi Breezemaster,

    This tutorial over at Gravity Wiz might be of use to you:

    http://gravitywiz.com/2012/05/19/simple-ticket-inventory-with-gravity-forms/

    Specifically the gform_get_field_values_sum() function in the snippet.

    Posted 12 years ago on Thursday May 24, 2012 | Permalink
  3. Hello David, this is exactly what I was looking for.
    Thanks for that.

    But if I'm not missing anything, the limit in this code is a fix value.
    Is there any chance to get the value of the entry limit?

    I searched for a solution in the documentation, but couldn't find any hint how to get the limit of entries per form.

    Or am I missing something?

    Posted 12 years ago on Friday May 25, 2012 | Permalink
  4. So you want to get the entry limit specified for a form (via the form editor)? This might be more of what you're talking about:

    http://gravitywiz.com/2012/04/25/display-number-of-entries-left-based-on-entry-limit/

    This assumes you're working from the gform_pre_render hook. If you want to access this information completely outside of Gravity Forms, you'll need to retrieve the form object first.

    [php]
    $form_id = 1; // update to your form ID
    $form = RGFormsModel::get_form_meta($form_id);
    $entry_limit = $form['limitEntriesCount'];
    Posted 12 years ago on Friday May 25, 2012 | Permalink
  5. Thank you very much!
    That was the missing piece!

    I think i have to combine both codes, but than it should work.

    again, Thanks a lot!

    Posted 12 years ago on Friday May 25, 2012 | Permalink