Hi,
We are trying to create a custom dropdown field, with custom values. We are using https://docs.gravityforms.com/gf_field_select/ for the reference, and below is our code.
Initially it is working perfectly on the frontend, but there seems to be an issue on the backend. When we edit the field and click on “edit choices” and then tick the “Show Values” checkbox, the initial set values are not showing on the frontend anymore. Instead the initial values has been overridden and the “label text” is now displayed as the value on the frontend.
Is this a bug in Gravity Forms? How to prevent this from happening?
Any help is appreciated, thanks in advance!
class WarmtepomptoegestaanField extends GF_Field_Select {
public $type = 'warmtepomp_toegestaan_field';
public $choices = array(
array(
'text' => 'Select option heat pump',
'value' => 'default'
),
array(
'text' => 'No',
'value' => 'false'
),
array(
'text' => 'Yes',
'value' => 'true'
),
);
public function get_form_editor_field_title() {
return esc_attr__( 'Heat pump allowed', 'wpalt' );
}
}
GF_Fields::register(new WarmtepomptoegestaanField());