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.

Adding custom attribute to form tag

  1. activore
    Member

    I need to add a custom attribute called ids to my gravityform <form> tag, so it will come out like:

    <form method='post' enctype='multipart/form-data' id='gform_3' ids='3,2' class='lead-gen' action='/test-page/'>

    Optimally, I would like this to be as easy as a shortcode like

    [gravityform id=1 ids='3,2']

    I'd really appreciate it if anybody has any ideas for how this could be achieved. I see that there's a gform_form_tag filter, but I'm not exactly sure how to use it to add an attribute.

    Posted 11 years ago on Monday January 14, 2013 | Permalink
  2. David Peralty

    What are ids, do you mean CSS ID? You can't add custom CSS ID tags to the form using the short code, but you can in the form editor. Under Form Settings -> Advanced, you can add your own attributes.

    Posted 11 years ago on Monday January 14, 2013 | Permalink
  3. activore
    Member

    Hi David. Thanks for the quick response!

    It's not the id, it's just a custom attribute that the js from another plugin (WP Cash+) uses for its unrelated purposes. So I need pretty much exactly what I put in my example code -- in addition to the id attribute, an ids attribute.

    The Form Settings > Advanced tag doesn't show me a way to add my own attributes. I can add classes, which i'm also taking advantage of, but I don't see any other way to affect the <form> tag itself.

    Posted 11 years ago on Monday January 14, 2013 | Permalink
  4. David Peralty

    Here is our hook for adding various things to the <form> element:
    http://www.gravityhelp.com/documentation/page/Gform_form_tag

    Posted 11 years ago on Monday January 14, 2013 | Permalink