How do I set custom css on field in error ?

How do I set custom css on field in error ?

ronald.woutersronald.wouters Posts: 9Questions: 4Answers: 0

Hi all,
I am using Editor with Bootstrap 4 integration. When a field is in error, the error message is displayed in red below the field.
However, the field itself still has the original "blue" border :

Normally you could apply the bootstrap "is-invalid" css class which would make the field border show up in the typical bootstrap red border color:

(In above screenshot I changed the border color manually with Chrome Dev Toos)

So my question is simple: how can I apply the correct boostrap css class when a field is invalid ?
Perhaps adding something to the "fieldErrors" response that is sent back from the server to the client ?

Regards,
Ronald Wouters

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Hi Ronald,

    At the moment you would need to use the submitComplete event handler which will give you the JSON data from the server, including the field names of the fields in error and then field().node() can be used to add a suitable class.

    Its a good point though - it would be good if Editor's Bootstrap integration did this out of the box. I've filed a feature request.

    Allan

This discussion has been closed.