• Resolved jaakkosaarenketo

    (@jaakkosaarenketo)


    My form has 2 different fields, birthday and checkbox of “are you under 18?”.

    I’ve made a validation with af_add_error that goes to the checkbox if the birthday is less than 18 years.

    However, the way Advanced Forms Pro works, is that that field has to be changed at least once in order for it to be validated. In this case, if the user was over 18 – they just filled the birthday -field wrong – not the checkbox.

    Can you help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hmm, I wasn’t aware of this behavior. The validation is 100% handled by ACF and I can’t seem to find any part of the ACF code that would cause this.

    Do you have a public site I could test the issue out on?

    Thread Starter jaakkosaarenketo

    (@jaakkosaarenketo)

    I just tested it on a separate site and it seems the problem isn’t as big as I thought.

    The form gets validated ok. It’s just if there’s other fields that are still invalid, the error messages stay on until everything (else) is correct.

    You can test here if you like:
    https://sandbox.favor-asiakas.fi/validation-test/

    Plugin Author fabianlindfors

    (@fabianlindfors)

    I think this might come down to how ACF handles validation. It only runs it when the form is actually submitted which could cause error messages to linger. You might be able to work around this by adding some custom JS to hide the messages earlier.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unvalidated field has to be changed even when no longer invalid.’ is closed to new replies.