Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Select2 and FormValidation Issue


I have followed this code (both html & js):

https://preview.keenthemes.com/html/metronic/docs/forms/formvalidation/advanced?_ga=2.176017122.1188950086.1690596666-950754628.1674302752#select2


Got this error (screenshot):
https://ibb.co/5BQD46S



Uncaught TypeError: element is null
addClass webpack://metronic/../demo1/src/plugins/@form-validation/cjs/core/index.js?:1099
addClass webpack://metronic/../demo1/src/plugins/@form-validation/cjs/core/index.js?:1098
classSet webpack://metronic/../demo1/src/plugins/@form-validation/cjs/core/index.js?:1131
classSet webpack://metronic/../demo1/src/plugins/@form-validation/cjs/core/index.js?:1131
install webpack://metronic/../demo1/src/plugins/@form-validation/cjs/plugin-framework/index.js?:69
install webpack://metronic/../demo1/src/plugins/@form-validation/cjs/plugin-bootstrap5/index.js?:59
registerPlugin webpack://metronic/../demo1/src/plugins/@form-validation/umd/bundle/popular.min.js?:11
formValidation webpack://metronic/../demo1/src/plugins/@form-validation/umd/bundle/popular.min.js?:11
formValidation webpack://metronic/../demo1/src/plugins/@form-validation/umd/bundle/popular.min.js?:11
formValidation webpack://metronic/../demo1/src/plugins/@form-validation/umd/bundle/popular.min.js?:20
<anonymous> http://localhost:9000/assets/js/store/add/general.js:98


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi,

May I know your Metronic version and demo? Could you please provide your HTML and JS code via https://gist.github.com/ ? We will need to debug your code in order to investigate your issue. Also please make sure you added fw-row class to the input group container in order to display the validation error messages as explained in the docs.

Regards.



Hi Sean, thanks for your help. The issue i misplaced fv-row. Its fixed now.



Hi happy,

Great! If you need any further help please do let us know.

All the best with your project!

Regards.


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.

Hi, can you please send your code for select, mine only displays the form validation message but not the icon


<div class="input-group mb-5 fv-row">
<span class="input-group-text" >
<i class="ki-duotone ki-shield fs-2x"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i>
</span>

<div class="form-floating ">
<select class="form-select form-select-solid" name="cbTest[]" data-control="select2" data-placeholder="Select test" data-allow-clear="true" multiple="multiple" required>
<option></option>
<option value="A">A</option>
<option value="B"><B></B></option>
<option value="C">C</option>
<option value="D">D</option>
<option value="E">E</option>
</select>
<label for="cbTest[]">User Role</label>
</div>
</div>


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(