Form validation on auiSelect2

I’m using “data-aui-validation-displayfield” to show validation for an auiSelect2 element, the error message is defined by using “data-aui-validation-required-msg” but the error message is not showing when validation invalid. Only error icon is showing.
image

I tried to use a normal input as “displayfield” and everything works fine.

Hello,

Are you trying to have a validation on the field being required? if yes you should use required=required as in the below example:

<div class="fieldgroup">
    <input data-aui-validation-field data-aui-validation-required="required" class="text" type="text">
</div>

Following this documentation https://docs.atlassian.com/aui/5.7.8/docs/formValidation.html there is no data-aui-validation-required-msg but rather data-aui-validation-required=“required”

Thank you Kallas,
I’m using version 8.1.0 of AUI at this link: Form validations - AUI Documentation
Unfortunately, my problem has not been resolved with your answer.

What about you share the html code you are trying?
What is the validation you are trying to do or is it just that it’s required?

I suggest you try the following you look into creating your own validator with JS as suggested in the documentation of AUI 8.1.0 you shared under ‘Plugin Validators’