How does Edit Entry handle hidden fields and field visibility settings?

Currently, there are two ways to include hidden fields in Gravity Forms: 

  • By using the Hidden field type;
  • By changing the field visibility on the "Advanced" tab of each field's settings to either "Hidden" or "Administrative".

GravityView does allow these fields to be visible and/or editable on the Edit Entry page of a View, however, there are some special conditions for that to happen. 

See below how that works for each field type:


Hidden field type

If the form has a Hidden Field, the Hidden field will only show up when using the gravityview/edit_entry/render_hidden_field filter (see code below). It doesn't matter if you manually added this field to the Edit Entry tab, its visibility is determined by the filter. 

Field with visibility settings

Visibility settings are found in each field's "Advanced" tab when editing a form in Gravity Forms. You can set the visibility for each type of field in Gravity Forms.

Fields with "Hidden" visibility 

The Visibility field setting, with 'Hidden' radio button selected.

These fields will only show up on the Edit Entry page if they have been manually added to the Edit Entry tab on the View editor:

Fields with "Administrative" visibility 

The Visibility field setting, with 'Administrative' radio button selected.

These fields show up when manually added to the Edit Entry tab or when the Edit Entry tab is empty. However, they are only visible for users with the Administrator role.


For developers: Filters to modify this behavior

To make Hidden fields visible and editable in Edit Entry:

// Converts `<input type="hidden">` to `<input type="text">`
add_filter( 'gravityview/edit_entry/reveal_hidden_field', '__return_true' );

To prevent Hidden fields from being output on the Edit Entry form HTML, add the following filter:

// Prevent hidden fields from being output in HTML at all
add_filter( 'gravityview/edit_entry/render_hidden_field', '__return_false' );

Note: you can also modify fields displayed in Edit Entry by using the gravityview/edit_entry/form_fields filter.


A timeline of changes regarding rendering Hidden Field fields in Edit Entry

When Edit Entry is not configured, all form fields show by default. The way GravityView has handled Hidden Field fields has changed over time.

Prior to Version 2.5 of GravityView, when Hidden Field fields were converted to text inputs, were visible, and were editable.

To allow modifying this behavior, the gravityview/edit_entry/reveal_hidden_field filter was added in 1.22.6. The filter could prevent Edit Entry from converting <input type="hidden"> to <input type="text">. If the filter returned false, the Hidden Field input would still be rendered in HTML, but would not be visible. 

With Version 2.5 in December 2019, GravityView changed how Hidden Fields behave when Edit Entry was not configured: Hidden Field fields would no longer be rendered in the form's HTML. The value of the input would no longer be visible in the webpage code, and the Hidden Field value would no longer be editable.

In Version 2.7 in February 2020, GravityView added the gravityview/edit_entry/render_hidden_field filter to control whether the Hidden fields are included in the HTML output or not. The default is set to true: render the input, but do not make it visible.

By using the gravityview/edit_entry/render_hidden_field and gravityview/edit_entry/reveal_hidden_field filters, you have control over how Hidden Field fields are displayed in Edit Entry.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.