form-validation icon indicating copy to clipboard operation
form-validation copied to clipboard

Bootstrap 5 row selector

Open piernik opened this issue 2 years ago • 2 comments

I'm using bootstrap 5 plugin. There is a rowSelector: ".row", which causes errors. If there is no row class it throws error and crashes application. There is plenty of examples where there will be no row class. For example form-floating variation: https://getbootstrap.com/docs/5.1/forms/floating-labels/

I know (now :/) that we can change row selectors, but if there is a good error message I can get to it much sooner :)

EDIT: Maybe something like this would be better:

       rowSelector: function (field, ele) {
          if (ele.parentElement && ele.parentElement.classList && ele.parentElement.classList[0]) {
            return '.' + ele.parentElement.classList[0];
          }
          return '.row';
        }

piernik avatar Aug 30 '21 08:08 piernik

@piernik I will add a warning in the console in the next version. Thanks for the suggestion.

phuocng avatar Aug 30 '21 09:08 phuocng

@phuoc-ng I edited my answer to suggest better (in my opinion) solution for selector

piernik avatar Aug 30 '21 09:08 piernik