Field Select

The Field Select setting, field-select, is an advanced setting type for selecting a specific field from the current list of fields in the form. This setting can be used as a field setting, action setting, or form setting. New fields added to the form will automatically be available. Likewise, fields removed from the form will also be removed from the field select options.

Screenshot 2016-04-25 13.22.44

The following example shows a basic ‘field-select’ definition.

<?php
// …
$this->_settings[ 'field_map' ] = array(
'name' => 'field_map',
'type' => 'field-select',
'label' => __( 'Field Map', 'ninja-forms'),
'width' => 'full',
'group' => 'primary',
/* Optional */
'field_types' => array(
'firstname',
'lastname'
),
'field_value_format' => 'merge_tag // merge_tag (default), key
);
// …

Specified Field Types

By default, all field types are used as options in the field select setting. The field_types` property can be set with specific field types as an array of strings.

Field Key Tracking

The selected field is identified by the unique field key. If the selected field’s key is changed, then the value of the field-select setting will be automatically updated (similar to merge tags).