Home › Forums › Add-ons › Repeater Field › Conditional on Repeater, after save post
I have a problem with using repeater with conditional fields, everything works fine until I save the post, but when editing the post the conditional fields do not follow the condition they should.
I use this for test:
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5bca5488b5583',
'title' => 'teste',
'fields' => array(
array(
'key' => 'field_5bca5511b1fd5',
'label' => 'repetidor',
'name' => 'repetidor',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => '',
'min' => 0,
'max' => 0,
'layout' => 'table',
'button_label' => '',
'sub_fields' => array(
array(
'key' => 'field_5bca5491301e8',
'label' => 'teste',
'name' => 'teste',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'LIGADO' => 'LIGADO',
'DESLIGADO' => 'DESLIGADO',
),
'default_value' => array(
),
'allow_null' => 0,
'multiple' => 0,
'ui' => 1,
'ajax' => 1,
'return_format' => 'value',
'placeholder' => '',
),
array(
'key' => 'field_5bca54bf301e9',
'label' => 'LIGADO',
'name' => 'ligado',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5bca5491301e8',
'operator' => '==',
'value' => 'LIGADO',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5bca54d0301ea',
'label' => 'DESLIGADO',
'name' => 'desligado',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5bca5491301e8',
'operator' => '==',
'value' => 'DESLIGADO',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'teste',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;
I just did a test with something similar and I’m not seeing any issue. Can you give a better explanation of ...but when editing the post the conditional fields do not follow the condition they should.
When adding a new post, logical conditionals work, after saving the post the conditional logic does not work.
This problem only happens on conditional fields inside of repeater and after save a post.
That is what you said in your OP. I have tested this and I’m not seeing any issues. Everything is working as I expect it to.
Please give more information and details on what you mean by “does not work correctly”
The topic ‘Conditional on Repeater, after save post’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.