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.

Add fields to Form Settings

  1. andrej1c
    Member

    Hi,

    Is there a good way to add an additional fields to the "Form Settings" area (/wp-admin/admin.php?page=gf_edit_forms) that could be saved with the form's serialized meta information in wp_rg_form_meta? I added some fields using the "gform_advanced_settings" hook but the values are not saving and are not available in $_POST either when I use the "gform_after_save_form" hook.

    Here is what I'm working on. We mapped Wordpress accounts to a custom taxonomy called "Groups". When you are logged in you only see content that is "tagged" with groups your account is mapped to - whether that is on the public site or in Wordpress admin. We have a DB table that handles tagging individual GF forms with this taxonomy. This allows us to specify that only a Wordpress admin that is "tagged" with Marketing can see entries from forms tagged with Marketing. The last piece that is missing is how the main administrator can "tag" the GF forms with this custom taxonomy so the permissions get properly set for department admins.

    All I need help with is putting some checkboxes onto the Advanced tab of Form Settings in a way that makes them available through gform_after_save_form so I can properly save it into our mapping table.

    Posted 12 years ago on Friday November 30, 2012 | Permalink
  2. Hi Andre,

    I'd highly recommend giving this tutorial a read:

    http://wpsmith.net/2011/plugins/how-to-create-a-custom-form-field-in-gravity-forms-with-a-terms-of-service-form-field-example/

    He covers actually creating a new field type in Gravity Forms (which is more than what it sounds like you want to do); however, as part of that process he also demonstrates how to save custom fields settings. This process will be the same for custom field types as well as existing field types with custom settings.

    Let me know if you have any other questions after reading through that article. :-)

    Posted 12 years ago on Saturday December 1, 2012 | Permalink
  3. andrej1c
    Member

    David,

    Thank you for posting a link to that tutorial. I'm bookmarking the link for when I need to add a new field type and I might use that one as is. However, it unfortunately did not include instructions on how to add a field to the form settings.

    While working on this I also found that http://www.gravityhelp.com/documentation/page/Gform_advanced_settings incorrectly states that gform_advanced_settings works identically to gform_field_advanced_settings and only thing you need to change is location. Try copying and pasting the example, changing the hook and location and you'll get javascript errors.

    Two hours later.... I solved this by binding the click event to all my checkboxes and manually setting properties of the form object:

    form.ad_groups = ....

    Then I used the gform_after_save_form hook and grabbed the AD groups this way:

    $form_meta = RGFormsModel::get_form_meta($form['id']);
    $ad_groups = $form_meta['ad_groups'];

    The I can save them to the database.

    Phew.

    Posted 12 years ago on Monday December 3, 2012 | Permalink
  4. Hi Andre,
    Thanks a lot for the follow up. We will make sure to update the documentation.

    Posted 12 years ago on Tuesday December 4, 2012 | Permalink

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