Support

Account

Home Forums Bug Reports "Required" validation won't disable for hidden conditional fields in repeater

Solved

"Required" validation won't disable for hidden conditional fields in repeater

  • Hi, I’ve noticed a bug having to do with conditional validation inside repeaters within the last version or two of ACF.

    Version: 5.1.9.1

    Reproduction steps:

    1. Create a repeater.
    2. Inside the repeater, create a sub field:
      • Type: True / False
      • Default: unchecked
    3. Inside repeater, create a sibling sub field:
      • Type: Url
      • Required: Yes
      • Conditional logic: display only if the True / False field is checked
    4. Save the field group.
    5. Go to a post to which this field group applies.
    6. Add a repeater row.
    7. Try to save post without checking the checkbox.

    The Url field is still required by validation, despite being hidden by the conditional logic.

    This bug may also apply to other field types. It doesn’t happen if those fields had a value at some point and still have that value in the database. It also doesn’t happen outside of a repeater.

    Let me know if you need more info.

    Thanks!

  • i can confirm such problems, but i had to add a even more worse problem created by a “similar” Environment

    i had repeater with 4-5 row before, 2-3 with no value inside url-field.

    after add true/false field and set required like described above
    i add 6th repeater row, because of not filled required field save fail.
    i check/uncheck true/false field and try to save again.
    strangely enough that works! but this bug happens:
    inside url field a value was filled that came from a other row. but not only inside the new row, it was filled inside every empty hidden url field.

    (fortunately i dont need such a setting at productive state, but that need of course a fix as soon as possible)

    If someone had the time he can test: if it happens with all conditional field inside repeater (like checkbox, radio-button, select, …) and if it happens to other fields than url too

  • I can confirm the bug was not present in 5.1.7.1 .
    For a travel agency web site I have two nested repeaters (Room Type > Prices) so that they can insert prices for double room, triple room, etc and for several dates for each room type.

    The price repeater has conditional logic to show the price field only for the selected room type; it worked perfectly till yesterday, when I updated to 5.1.9.1 .
    Now every time I try to save a post, I get an error stating that 6 fields are missing (e.g. if I typed values for double room prices, the missing fields are for single, triple and quadruple room price).

    Fortunately I was able to downgrade to 5.1.7.1 from a backup.

  • I can confirm that 5.1.7.1 is working fine.

    The issue is still present in 5.2.0.

    Besides downgrading the plugin version, another workaround is to toggle the conditional to show the required field with the error message and fill it with something. Then toggle back the conditional to what it was before. Now when you submit there won’t be any error message, since all required fields have been filled out regardless of conditional state.

  • I have the same problem but it doesn’t have to be repeater field. I have found that the problem also occurs on Flexible contents layouts.

    This is frustrating because we have made site where you can stack as many component as you want made with flexible content so there might easily be 10-20 validation errors on fields that aren’t even visible (so you can’t see them and apply workaround mentioned above that easily).

  • I can also confirm that this issue was not present in 5.1.8. Rolling back to that version works as a temporary fix.

  • I just wanted to add that I’m also having this issue too.

    I have a repeater field with a tabbed option in a dropdown.

    I’ve even made the field NOT required, but it still fails on validation if you use the default option.

    To make it validate, I need to individually go through each field and switch them to something else and then back again.

    This is on a site with mutliple contributors, which is causing me all sorts of headaches. I can also confirm this only came about after updating from 5.1.8.

    Cheers!

  • I’m having this problem as well on multiple live client sites. Now I need to either downgrade or make fields optional. This bug was not present on 5.1.7.1, for example.

  • I’ve notified the support team of ACF which has in turn notified the developer. The support team suggested downgrading to 5.1.8 until the bug has been fixed.

  • I too have experienced this, I have created a video showing the issue: https://youtu.be/jdwA2suQQEw

  • What will be the target version in which this bug will be fixed?
    This is a huge issue for us right now.

  • What will be the target version in which this bug will be fixed?
    This is a huge issue for us right now.

    Agreed. This is forcing us to downgrade/deliberately keep ACF out of date on every site we use it.

  • Anyone had the chance to test of this is fixed in 5.2.2?

  • Hi guys

    I’ll do some testing and get back to you, but in the meantime can you please update to 5.2.2

    This update contains some fixes for conditional logic and disabled inputs.

    Thanks
    E

  • Hey all,

    Tested this update today and the issue is resolved on all my sites that were having trouble.

    I had about 20 sites with various issues to do with this and they all appear to be working correctly now.

    Thanks Elliot

  • Hi, I’m still getting this on 5.2.2

    When saving the post it says “Validation failed. 1 required field below is empty”.

    The only thing I need to do to fix it is checking the checkbox that makes the hidden inputs visible. I’ll then see the error message next to the field. Then I uncheck and hit save again and it will work.

    The field in question is a Repeater field which has conditional logic to display if the checkbox is checked (“Stablet”=checkbox, see attachment).

  • Hi @bjornbjorn

    Thanks for the info. Can you please export and attach the field group .json?

    I’ll do some testing and get back to you

    Thanks
    E

  • This reply has been marked as private.
  • Hi @bjornbjorn

    Thanks for the export (I only needed the one field group, not all). You can select a single field group on the export page.

    I have imported and tested your field group and have found the issue. I’ll do some more testing and have a fix for this ASAP

    Thanks
    E

  • Hi @bjornbjorn

    Found and fixed the issue. Just emailed you with more info.

    Thanks
    E

  • Can confirm that the new version fixed my issue. Thanks 🙂

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

The topic ‘"Required" validation won't disable for hidden conditional fields in repeater’ is closed to new replies.