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.

Can you specify more than one form id for the gform_pre_render action/hook?

  1. I understand you can specify the form id in the filter such as:
    add_action('gform_pre_render_57', 'add_surcharge_js');
    where 57 represents the form id.

    But is there a way to specify that I want this action/hook to apply to multiple forms? If so, how do I do it? Do I just append additional form id's to the action name?

    Posted 9 years ago on Tuesday November 22, 2011 | Permalink
  2. Sure, but not the way you described. You wouldn't use gform_pre_render_FORMID you would simply use gform_pre_render.

    Then in your custom code you would use a switch or if statement to see what the form id is, and then execute whatever code you want to execute for that form id.

    gform_pre_render_FORMID automatically applies to whatever form id you set. But gform_pre_render executes for ALL forms. So if you then use custom code to do it for only selected forms within your code, that will have the same result.

    Posted 9 years ago on Tuesday November 22, 2011 | Permalink