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.

Remove a field completely from the form entries in the backend

  1. Hi,
    Been stuck over this for a long time now!
    I have a contact form, in which I'm using a couple of hidden fields to store values (pre populating them using 'gform_pre_render') to be used by jQuery popups. These fields are just dumb place holders (but it should be submitted because I require the submitted values to do some after form submission stuff).

    I don't want the entries for these fields to appear in any of this form's single entries in the backend. There are 2 ways I tried this:

    1. Using gform_pre_submission, to remove the field while submitting the form itself
    2. Using gform_entry_field_value, to remove the field when rendering the corresponding single entry in the backend. This works but the 'tr' for this fields label and value still appears in the backend single entry view ( with no text ofcourse, just blank trs and tds).

    Lets say my hidden fields are 'Popup Text' and 'Priority'. I'm using Popup Text as a place holder for some data inserted using gform_pre_render, and manipulating Priority with a value using jQuery. So I don't want either of these entries to appear in the backend entry display, but I need the submitted priority to do some processing.

    Here's my code if you need to see it:
    http://pastebin.com/ANQiLUWP

    I hope I'm clear on this! Precisely, I just want to completely remove a field from the form entry single display page (and 'edit' entry as well) in the backend.
    Any way I can do this?
    Thanks,
    rtCamp

    Posted 12 years ago on Wednesday February 29, 2012 | Permalink
  2. Just an update... I dived into entry_detail.php and found this filter being applied there:

    gform_field_content

    So the following worked for me...

    add_filter('gform_field_content', 'rtp_remove_field', 10, 4);
    function rtp_remove_field($content, $field, $value, lead_id, form_id){
        if(RG_CURRENT_VIEW == 'entry'){
            if($field['label'] == 'My Label' || $field['cssClass'] == 'my_choice'){
            }
            else{
                return $content;
            }
        }
        else {
                return $content;
        }
    }

    Just please let me know if this is a safe way to do so.
    Thanks if anyone has looked into this.

    Rutwick,
    rtCamp.

    Posted 12 years ago on Wednesday February 29, 2012 | Permalink