Home Forums General Issues True/False required field is asking to be checked


True/False required field is asking to be checked

  • I’ve been updated to ACF 5.8.9 recently.

    I have F field of type True/False. It’s marked as required (with False default value).

    It was OK in the past. But with 5.8.9, I can’t save a post with unchecked F field. I see: F requires a value. (Even a new post.)

    Is it expected behavior?
    Has it been changed?


  • This is expected behavior and I think it has always worked this way.

  • John, thanks for reply!

    But… False is also a value, no?

    The field is required. It is expected to have a value. False is also a value.

  • Actually, no, false is not a value. A true false field is actually a checkbox field and a checkbox field only has a value if it is checked. This is because a checkbox field creates an array of checked items and with nothing checked the array is empty.

    Setting required on this field only makes sense if you want to refuse submission if it is not checked for something like “I agree with….”

    There are only two possible values, true and false, if you will except either then there is no reason to make it required.

  • Ok, you’re right. At last, “” isn’t a value for text field.

    But, then, we need a tri-state field 😀

    • True
    • False
    • undefined
  • I’d use a radio or select field

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

The topic ‘True/False required field is asking to be checked’ is closed to new replies.