GF_Field_Hidden

Introduction

The GF_Field_Hidden class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the Hidden field and the Hidden Quantity field are rendered when the form is displayed and how its value is handled during and after form submission.

Settings and Properties

Settings control what options are available to the admin user when configuring the field in the form editor. Gravity Forms includes many built-in settings such as Field Label, Field Description, Choices, Conditional Logic, etc. In addition to built-in settings, custom settings can also be developed. For more information on how to develop custom settings and how to associate settings to a field, visit the GF_Field page.

Properties contain the values specified by the settings and generally are part of the Field Object.

The properties may be retrieved by accessing the Field Object as follows:

//get the field
$field = GFFormsModel::get_field( $form, 1 );

//get the label
$label = $field->label;

Settings

The following settings are available for the field:

  • default_value_setting
    Controls whether the “Default Values” section displays. This allows a value to be set for the field.

  • label_setting
    Controls whether the “Field Label” setting which allows the label to be changed appears.

  • prepopulate_field_setting
    Controls whether the “Allow field to be populated dynamically” setting appears.

Properties

Below is a listing of the properties inherited from the parent class, and the properties unique to the field:

  • allowsPrepopulate boolean

    Determines if the field values can be dynamically populated. Default is false.

  • defaultValue string

    The default value to be set in the field. If this is not changed, it is the value submitted.

  • formId integer

    The form ID.

  • id integer

    The field ID.

  • inputName string

    The parameter name used when dynamically populating the field.

  • inputType string

    This property is only available if this is a hidden Quantity field. The inputType will be set to hidden, while the type will be set to quantity.

  • label string

    The field label that will be displayed on the form and on the admin pages.

  • productField integer

    This property is only available if this is a hidden Quantity field. The id of the product field to which the field is associated.

  • type string

    The field type. This is set to “hidden”, unless this is a hidden Quantity field, then the type will be quantity.

Source Code

The source code is located in includes/fields/class-gf-field-hidden.php in the Gravity Forms folder of your sites plugins directory.