Skip to content

Commit

Permalink
change wrapper element assignment so wrapper_error_class is assigned …
Browse files Browse the repository at this point in the history
…to correct wrapper element
  • Loading branch information
MichalRemis committed Apr 17, 2020
1 parent 325adb6 commit f28196b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.bootstrap4.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = {
wrappers: {
default: {
add (element, settings, message) {
const wrapperElement = element.parent()
const wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/\ /g, '.'));
let errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback')

if (!errorElement.length) {
Expand All @@ -29,7 +29,7 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = {
},

remove (element, settings) {
const wrapperElement = element.parent()
const wrapperElement = settings.wrapper_tag + "." + settings.wrapper_class.replace(/\ /g, ".")
const errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback')

wrapperElement.removeClass(settings.wrapper_error_class)
Expand Down

0 comments on commit f28196b

Please sign in to comment.