Best solutions for accessing a variable in various gf render related filters when it's an ajax enabled multi page form

I’m looking for the best solution to ensure that when ajax triggers gf render related filters like pre_render, field_render, etc, that a specific variable value can be exposed to the custom functions I have attached to these filters.

Here are a number of details about our solution:

  1. We have a custom block with a php callback script that renders the block
  2. The callback script renders some HTML that includes a gravity form which is ajax enabled and multi-page.
  3. There is a variable (cpt_id) whose value is only currently available to the callback script and is specific to each instance of the block.
  4. The block will only be added only once to any one page in the website
  5. We have a number of custom php functions that are called from various gravity form filters related to form rendering.
  6. All of these gravity form filter events are triggered after the block php callback script has run.
  7. The first filter event, gf_pre_render called (on page load) does have access to the variable that we put in a singleton
  8. Any singleton or global will fail following the initial page load and after the first triggered gf_pre_render filter

Our problem is to ensure that any of the functions associated with the gravity form render related filters can access the cpt_id value.

Singletons and globals will fail. We toyed with a hidden field as my assumption is that this is the nicest approach. However getting its default value in some filters is troublesome, although I assume possible. I’m starting to think that perhaps the wp_options table may be our best approach.

Just wondering if anyone could please offer what they would be looking at in this situation?

Any advice welcome.

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.