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.

on submit form filters

  1. sboisvert@bryxal.ca
    Member

    In version 1.4 I used to be able to modify the form object and modify the fields with their id's like such:

    add_action("gform_pre_submission", "liberal_handle_forms");
    function liberal_handle_forms($form_meta){
    $form['5.2'] = 'foo';
    return $form_meta;
    }

    But that doesn't work anymore, I can't seem to find the results anywhere. Neither in gform_pre_submission or in gform_pre_submission_filter.

    The current documentation doesn't seem to refer anywhere on how to change the values of fields before saving them, Am I looking at the wrong place?

    Thanks,

    -Steph

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink
  2. Have you looked at the documentation for the gform_pre_submission hook? It does discuss what you described. You can find it here:

    http://www.gravityhelp.com/documentation/page/Gform_pre_submission

    You can also change the value using the gform_post_submission hook which updates the entry data itself. Documentation for this is here:

    http://www.gravityhelp.com/documentation/page/Gform_post_submission

    The difference is gform_pre_submission happens before the data is stored and gform_post_submission happens after the data is stored.

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink
  3. sboisvert@bryxal.ca
    Member

    The problem is that it doesn't seem that the form object is the same as it was before. And the documentation makes no mention whatsoever of being able to set the fields like such. It seems like the form object is different depending on the context. I was getting it looking like this:
    http://pastebin.com/hmjvSa1f
    where I can edit values, and I can edit values of admin only fields. Something it appears I cannot do in the documentation you refer to since it refers to changing the values of the fields by changing the values of the $_POST superglobals.
    While it now looks like this: (this is the one that resembles what the documentation refers to)
    http://pastebin.com/iT6a2KWB

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink
  4. The form object and handling of the form object changed with the release of Gravity Forms v1.5 to accomodate multi-page forms. It necessitated changes to some hooks. You will need to adjust your code based on the gform_pre_submission hook documentation, it should accomplish the same thing.

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink
  5. sboisvert@bryxal.ca
    Member

    The documentation doesn't seem to mention how to modify admin only fields, Do I need to make all fields publicly viewable?
    Are there any plans to enhance the documentation?

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink
  6. Admin only fields can be modified the same way as non-admin only fields. If you are dynamically populating an admin only field it exists as a hidden field on the form. You have to set the field to be able to be populated dynamically to do this, otherwise you have to use the gform_post_submission hook and edit the entry data after it's been created upon form submission.

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink