Support

Account

Home Forums Bug Reports Delete Repeater row not staying deleted with conditional logic

Solved

Delete Repeater row not staying deleted with conditional logic

  • Hi Elliot,

    This might be a small bug (or might be unintiutive for me)

    Setup:

    Checkbox using conditional logic which shows Repeater fields when checked. Repeater sub-field is a text field.

    Process (editing a page here):
    1. Check checkbox
    2. Repeater field shows
    3. Add field & add text to field
    4. Save page
    5. Delete field and uncheck checkbox (which hides Repeater)
    6. Save Page

    What happens:
    If I recheck the checkbox, the deleted field is still there.

    What I expect to happen:
    If I recheck the checkbox, the deleted field is not there.

    And thanks for the brilliant plugin!

    Frances

  • This is not a bug and is working as expected. This topic comes up frequently.

    Hidden field data will not be saved if the field is hidden because the field is into included with the submitted data. This also means that if the field has a previous value and then it is hidden, the field is not submitted. With no submitted field the field is not updated.

    When it comes to fields with conditional logic you must check those conditions on the front end to make the decision of what conditional fields to use and you can’t rely on the presence or absence of a value in the conditional fields.

    Some call this a bug and some call this a benefit. Most of my clients expect that if they change there mind 20 times that they won’t need to reenter the data 20 times. For me this is a benefit, otherwise I would end up writing something to prevent it form happening.

    You can, if you choose, write an acf/save_post action to check these conditional fields and delete the content from the database for fields where you don’t want them to remember values.

  • Hi John,

    thanks for your quick and comprehensive reply.

    I did search but didn’t find anything.

    For me, I’ll stick with unintuitive, verging on a bug in the case where I actually deleted the contents of a field on a page and then hid that field by unchecking a conditional checkbox. I would expect that physical act of deleting to be carried over. (As distinct from if I just checked/unchecked a conditional field, I would expect the fields & data it shows would not be affected.)

    Good to know about save_post_action also, thanks.

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

You must be logged in to reply to this topic.