I want to validate textarea but when I use it, an error appears and I can't find the problem:
plugins.bundle.js:26270 Uncaught TypeError: Cannot read properties of null (reading 'classList')
the javascript:
validator = FormValidation.formValidation(
form,
{
fields: {
'target_details_1': {
validators: {
notEmpty: {
message: 'Textarea input is required'
}
}
},
},
// fields: applyValidationToInputs(form), // Dynamically add fields validation
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap: new FormValidation.plugins.Bootstrap5({
rowSelector: '.fv-row',
eleInvalidClass: '',
eleValidClass: ''
})
}
}
);
the HTML:
<!--begin::Input group-->
<div class="d-flex flex-column mb-8">
<label class="fs-6 fw-semibold mb-2">Target Details</label>
<textarea class="form-control form-control-solid" rows="3" name="target_details_1" placeholder="Type Target Details" required></textarea>
</div>
<!--end::Input group-->
Hi,
Please make sure to have fv-row
class on the input field wrapper elements. This class is used by the Form Validation plugin to access the fields to validate.
For more info please check Form Validation Guide.
Regards,
Sean