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.

Programmatically add a field to a form at 'gform_post_submission' stage

  1. Hello,
    I would like to define a new field and set a value for it programmatically using the gform_post_submission hook.
    Is this doable ?
    Best regards,
    Antoine

    Posted 13 years ago on Wednesday October 26, 2011 | Permalink
  2. Hi Mediana,

    If you could share some more details about what your end goal is I might be able to better answer your questions. :)

    Posted 13 years ago on Wednesday October 26, 2011 | Permalink
  3. I use a form to publish new posts and I have to use a function define the taxonomy triggered by a hook at submission time rather than adding a field to the form, passing the value in the shortcode and hiding the field to the user using CSS. It would be more secure.

    Posted 13 years ago on Monday November 7, 2011 | Permalink
  4. Is this clear enough David ?

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink
  5. Fields can't be added to the form programmatically. The field would have to exist on your form in order for you to dynamically populate it. I'm still not entirely clear what you are trying to do based on your description. You wouldn't have an infinite number of taxonomy types so there is no reason why you can't add a field for each taxonomy type and set their visibility to admin only and then populate them via the shortcode. Then the user wouldn't see them on the form.

    Posted 13 years ago on Tuesday November 8, 2011 | Permalink