The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

Re Validation form (Metronic 8.2- html)


Hello,

How can the form validation function be called again in Metronic 8.2? Because when an item in the form is removed or added by hide() and show(), the validation on these items does not work correctly.

When an item is hidden, the class "fv-row" is removed from the div.
When an item is show, the class "fv-row" is added to div.

Despite what I have mentioned, the form validation still does not work correctly on the new changes and seems to require being called again.

I would appreciate your guidance. Thank you!


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

Deleted comment
 
Deleted comment
 
Deleted comment

Hi,

Please try to refer to the official docs of the plugin https://formvalidation.io/ and refer to the below code:

<pre> // Assume `form` is the form element, and `validator` is the FormValidation instance const form = document.querySelector('#yourFormId'); const validator = FormValidation.formValidation(form, { fields: { // Define your fields and their validation rules fieldName: { validators: { notEmpty: { message: 'This field is required', }, }, }, }, plugins: { trigger: new FormValidation.plugins.Trigger(), bootstrap: new FormValidation.plugins.Bootstrap(), }, }); // When an element is shown function onElementShown() { // Update FormValidation to revalidate the shown element validator.addField('fieldName', { validators: { notEmpty: { message: 'This field is required', }, }, }); } // When an element is hidden function onElementHidden() { // Update FormValidation to ignore the hidden element validator.disableValidator('fieldName'); } </pre>

Regards, Sean

Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.