contributte / live-form-validation

:no_entry: Nice client-side live form validation for Nette Forms.

Home Page:https://contributte.org/packages/contributte/live-form-validation.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error classes color

camohub opened this issue · comments

commented

Hi, I would like to have span with class="help-block text-danger" colored to red. But Bootstrap needs to have .has-error class on parent element. As I founded out live-form-validation adds .has-error to input element which does nothing and span has black color. Am I doing something wrong?

You need to have correctly set the "showMessageClassOnParent" option. By default it is "form-group", so it searches parent with this class to which it will set the "has-error" class.

Make sure your parent elements has "form-group" class, or change options of live-form-validation to fit your needs.

commented

You are right, but I have not form-group parents so it means to add parentClass to every form in project.

Yes, that seems like solution, but you will realize at least one problem with it - if you have more inputs in the form, and you will successfully fill single input, it will remove the "has-error" from whole form, even though the other fields are still invalid.

Better would be either to provide form-group parents, as designed. Or, if you care only about style of error message, just style it by yourself.

commented

Yes I style it by messageErrorClass. Thank you.