bootstrap-validator icon indicating copy to clipboard operation
bootstrap-validator copied to clipboard

Display error message bug on validation of input type hidden

Open andrea-86 opened this issue 7 years ago • 2 comments

I have necessity to validate an hidden field that i populate with a value with jquery event. The validation is forced by adding the data-validate="true" but the help-block was not filled with the error message so it's impossible for the user to see why the form didn't submit.

Here in JS fiddle a fast example:

https://jsfiddle.net/andrea_86/5n2hex6h/

How can fix this?

andrea-86 avatar Apr 07 '17 07:04 andrea-86

I'm not able to force the validation by adding data-validate="true" on the type="hidden" input field, nor using $.fn.validator.Constructor.INPUT_SELECTOR, so I can't repro your issue...

Instead, I try <input class="hidden" type="text" ...> and (I think) it works well.

meteorlxy avatar Jun 22 '17 15:06 meteorlxy

I had the same issue. Using class="hidden" and type="text" (or your preferred type) I got the validator to validate the input. To make it aware of a value change made by jQuery we used .trigger('change') on the input. Would be better if it would be possible out of the box, but works like a charm.

SimJoSt avatar Feb 26 '18 16:02 SimJoSt