This thread is resolved. Here is a description of the problem and solution.
Problem:
Client has a CRED from with sections hidden in collapsible Bootstrap panels, and so needs to expand all panels if there is a validation error.
Solution:
There are no public custom front-end CRED events that can be used, but it is possible by adding the following jQuery in the custom JS section of the form:
I checked with the developers if there are any custom JS events that would be triggered by form invalidation and was told no, though it is an area of CRED that needs reviewing and improving.
We may be able to contrive a solution, but which form validation are you talking about, first?
Do you mean the Types validation that occurs on the front-end (e.g. where a Types field is required), or do you mean server side validation where you use the CRED API to include custom validation? And forms submit via page reload or ajax?
Front end, ajax submit.
If any errors in the form, that prevents it from being submitted, like required fields.
(I have grouped form fields in bootstrap accordion panels. If there are any errors in the form I need to expand all panels so the user can see all fields with errors).
I tried this but it does not fire in all browsers. Only Chrome is ok.
Yes, I can see how that works, because if there are no errors the form is submitted and the page updates and so expanding the panels is irrelevant.
Can't account for why using $("form") doesn't work in Safari an FF, though.
As I mentioned before, I spoke to the developers and they acknowledge that this is an area where CRED is lacking, and this code needs refactoring, at which point they can add custom JS events, but I can't say when that might happen.