Support

Account

Home Forums Bug Reports REST API Can’t update `null` value on nested field group

Helping

REST API Can’t update `null` value on nested field group

  • Hello,
    I have an issue that i can’t update my field (number) value to null when it’s placed on a nested group.

    It’s works fine if the field placed as a root field. But when i placed it to a nested group, the previous value won’t change.

    This is how my field group looks like

    • Sections (Group)

      • Section One (Group)

        • Offset (Group)

          • Top (Number)

    How To Reproduce
    – Create a field group with this structure:

    
    [
        {
            "key": "group_64c5c90bc6005",
            "title": "Test Post Fields",
            "fields": [
                {
                    "key": "field_64c5ca1e7f880",
                    "label": "Sections",
                    "name": "sections",
                    "aria-label": "",
                    "type": "group",
                    "instructions": "",
                    "required": 0,
                    "conditional_logic": 0,
                    "wrapper": {
                        "width": "",
                        "class": "",
                        "id": ""
                    },
                    "acfe_save_meta": 0,
                    "layout": "block",
                    "acfe_seamless_style": 0,
                    "acfe_group_modal": 0,
                    "acfe_settings": "",
                    "acfe_permissions": "",
                    "sub_fields": [
                        {
                            "key": "field_64c5ca317f881",
                            "label": "Section One",
                            "name": "section_one",
                            "aria-label": "",
                            "type": "group",
                            "instructions": "",
                            "required": 0,
                            "conditional_logic": 0,
                            "wrapper": {
                                "width": "",
                                "class": "",
                                "id": ""
                            },
                            "acfe_save_meta": 0,
                            "layout": "block",
                            "acfe_seamless_style": 0,
                            "acfe_group_modal": 0,
                            "acfe_settings": "",
                            "sub_fields": [
                                {
                                    "key": "field_64c5ca3e7f882",
                                    "label": "Offset",
                                    "name": "offset",
                                    "aria-label": "",
                                    "type": "group",
                                    "instructions": "",
                                    "required": 0,
                                    "conditional_logic": 0,
                                    "wrapper": {
                                        "width": "",
                                        "class": "",
                                        "id": ""
                                    },
                                    "acfe_save_meta": 0,
                                    "layout": "block",
                                    "acfe_seamless_style": 0,
                                    "acfe_group_modal": 0,
                                    "acfe_settings": "",
                                    "sub_fields": [
                                        {
                                            "key": "field_64c5ca527f883",
                                            "label": "Top",
                                            "name": "top",
                                            "aria-label": "",
                                            "type": "number",
                                            "instructions": "",
                                            "required": 0,
                                            "conditional_logic": 0,
                                            "wrapper": {
                                                "width": "",
                                                "class": "",
                                                "id": ""
                                            },
                                            "acfe_save_meta": 0,
                                            "default_value": "",
                                            "acfe_settings": "",
                                            "acfe_validate": "",
                                            "min": "",
                                            "max": "",
                                            "placeholder": "",
                                            "step": "",
                                            "prepend": "",
                                            "append": ""
                                        }
                                    ],
                                    "acfe_group_modal_close": 0,
                                    "acfe_group_modal_button": "",
                                    "acfe_group_modal_size": "large"
                                }
                            ],
                            "acfe_group_modal_close": 0,
                            "acfe_group_modal_button": "",
                            "acfe_group_modal_size": "large"
                        }
                    ],
                    "acfe_group_modal_close": 0,
                    "acfe_group_modal_button": "",
                    "acfe_group_modal_size": "large"
                }
            ],
            "location": [
                [
                    {
                        "param": "post_type",
                        "operator": "==",
                        "value": "post"
                    }
                ]
            ],
            "menu_order": 0,
            "position": "normal",
            "style": "default",
            "label_placement": "left",
            "instruction_placement": "label",
            "hide_on_screen": "",
            "active": true,
            "description": "",
            "show_in_rest": 1,
            "acfe_display_title": "",
            "acfe_autosync": "",
            "acfe_permissions": "",
            "acfe_form": 1,
            "acfe_meta": "",
            "acfe_note": ""
        }
    ]
    

    – Update value via REST API (using postman or similar tools)
    METHOD: PUT
    ENDPOINT: /posts
    BODY:

    
    {
        "acf" : {
            "sections": {
                "section_one": {
                    "offset": {
                        "top": 100
                    }
                }
            }
        }
    }
    

    – Check the current value, then you will see the value is 100
    – Then try to update the value again with this request body

    
    {
        "acf" : {
            "sections": {
                "section_one": {
                    "offset": {
                        "top": null
                    }
                }
            }
        }
    }
    

    – Check current value, then you will see the value still 100

    I Hope that’s clear enough.

    Thank you

  • I’ve got the same problem.
    What is the status of this bug?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.