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.
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.
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.
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?
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'];
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!