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.

Pre render hidden field

  1. I want to change the value of a hidden field in a gform_pre_render filter. Is this possible?
    What I now use is; $form["fields"][88]["defaultValue"] = "someValue"; but this doesn't work.
    88 is the ID of the hidden field in the current form.

    Any ideas?

    Posted 11 years ago on Saturday January 5, 2013 | Permalink
  2. It's not related to being hidden. You need to check which array item field 88 is in your $form object. I added two fields to a form, and made the second one hidden. In the form object, it is
    $form["fields"][1] not the field ID of 2. Here is how I set the default value for hidden field 2:

    [php]
    $form["fields"][1]["defaultValue"] = "Populated in my function";

    Please dump the form object and find out what the array index is for field ID 88 and use that in your pre_render function.

    Posted 11 years ago on Monday January 7, 2013 | Permalink
  3. Hi Chris,

    This indeed seems to work thanks!

    Posted 11 years ago on Monday January 7, 2013 | Permalink
  4. Awesome. Thank you for the update.

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink

This topic has been resolved and has been closed to new replies.