Home › Forums › Add-ons › Repeater Field › Issue with conditionals in repeater
I am using acf v5.3.6.1 which has the repeater now built in.
I have 3 fields added to the repeater. 1x select box and 2x text fields. What I am trying to do is only show one of the text fields in the case the select box has a certain value. I have given the conditional logic to the text field ‘select equal to x’ however the text field still seems to always show?
Thanks.
Hi @aedandev
I’ve just tested it on my end, but couldn’t reproduce the issue you had. Could you please share the JSON export of your field group so I can test it out in my installation?
Also, ACF has version 5.3.7 now. Could you please update it?
Thanks!
{
"key": "group_570454af8e9ab",
"title": "Call to action",
"fields": [
{
"key": "field_570454b47c022",
"label": "Call to action title",
"name": "call_to_action_title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Call to action title",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570454c77c023",
"label": "Call to action description",
"name": "call_to_action_description",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Call to action description",
"maxlength": "",
"rows": "",
"new_lines": "wpautop",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570454e27c024",
"label": "Call to action image",
"name": "call_to_action_image",
"type": "image",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "array",
"preview_size": "thumbnail",
"library": "all",
"min_width": "",
"min_height": "",
"min_size": "",
"max_width": "",
"max_height": "",
"max_size": "",
"mime_types": ""
},
{
"key": "field_570454f37c025",
"label": "Call to action image URL",
"name": "call_to_action_image_url",
"type": "url",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Call to action image URL"
},
{
"key": "field_5704550c7c026",
"label": "Call to action buttons",
"name": "call_to_action_buttons",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"collapsed": "",
"min": "",
"max": 3,
"layout": "table",
"button_label": "Add Button",
"sub_fields": [
{
"key": "field_570455267c027",
"label": "Button type",
"name": "button_type",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"external-url": "External URL",
"phone-number": "Phone number",
"enquiry-form": "Enquiry form",
"enquiry-form-address": "Enquiry form with address"
},
"default_value": [],
"allow_null": 0,
"multiple": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"disabled": 0,
"readonly": 0
},
{
"key": "field_5704556c7c028",
"label": "Button label",
"name": "button_label",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Button label",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570455797c029",
"label": "Button URL",
"name": "button_url",
"type": "url",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_570455267c027",
"operator": "==",
"value": "external-url"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Button URL"
}
]
},
{
"key": "field_5704559b0e24e",
"label": "Call to action products",
"name": "call_to_action_products",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"collapsed": "",
"min": "",
"max": "",
"layout": "table",
"button_label": "Add Product",
"sub_fields": [
{
"key": "field_570455b20e24f",
"label": "Title",
"name": "title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Title",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570455b90e250",
"label": "Description",
"name": "description",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Description",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570455c30e251",
"label": "Price",
"name": "price",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Price",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570455ce0e252",
"label": "Button label",
"name": "button_label",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Button label",
"prepend": "",
"append": "",
"maxlength": "",
"readonly": 0,
"disabled": 0
},
{
"key": "field_570455dd0e253",
"label": "Button URL",
"name": "button_url",
"type": "url",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Button URL"
}
]
}
],
"location": [
[
{
"param": "user_role",
"operator": "==",
"value": "all"
},
{
"param": "user_form",
"operator": "==",
"value": "edit"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"modified": 1460002594
}
not sure if that is how I should have shared it. Haven’t updated yet but hopefully will later today. You can see under the ‘call_to_action_buttons’ repeater there is the 1xselect box and 2xtext fields and the text field ‘button_url’ has the conditional relating to the value of the ‘button_type’ select box.
Hi @aedandev
I’m afraid I couldn’t import it. Could you please upload the file instead of copying it in a post? You can upload it by clicking the link button on the left or use a third-party storage service.
Thanks!
The topic ‘Issue with conditionals in repeater’ 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.