I am currently working on a new field module for ACF, and I’m running into a really aggravating issue. Here’s a sample of my code:
function render_field_settings( $field ) {
acf_render_field_setting(
$field, array(
'label' => 'Select ',
'instructions' => __('Select ','acf-i_am_a_name'),
'type' => 'hidden',
'name' => 'i_am_a_name_base',
'class' => 'acf-i_am_a_name parent_container',
)
);
acf_render_field_setting(
$field, array(
'label' => __('Extension Filter','acf-i_am_a_name'),
'instructions' => __('To show only certain something, enter a comma separated list here.)','acf-i_am_a_name'),
'type' => 'text',
'name' => 'something_filter',
'class' => 'acf-i_am_a_name',
)
);
}
Now what I do, is do something like
$('.i_am_a_name_base').val(some_val);
With jquery to change the fields value.
Oddly enough, I can only get the field to change if I do
$('.i_am_a_name_base').attr('value', some_val);
The issue is, I CAN get the field value to change, however as soon as I hit save the change is gone. However, and this is the wierd part, if I change it with jquery and then ALSO update another field the jquery change also sticks.
I took a look at event binds in the dom, and realized that on text field on change events were firing an event that updated the “_acfchanged” in the acf-form-data hidden section.
I tried manually changing that field as well, but the changes still do not stick.