Form validation with js not working


Topic: Form validation with js not working

demzl25 pro premium priority asked 2 years ago

Expected behavior

Hi, I'm not able to set up form with first js and second server-side validation.

Actual behavior

Form validation is not working with js.

Resources (screenshots, code snippets etc.)

Here is example code snippet: https://mdbootstrap.com/snippets/standard/demzl25/3912833#html-tab-view

Thanks,

Damjan


Grzegorz Bujański staff answered 2 years ago

First, replace the code responsible for validation with the code that adds event listeners - the code responsible for validation must be at the top.

Additionally, validation will not work correctly if valid and invalid feedback is not an input sibling.


demzl25 pro premium priority commented 2 years ago

Thanks that is helpful!


demzl25 pro premium priority commented 2 years ago

Is this what you have in mind? https://mdbootstrap.com/snippets/standard/demzl25/3912833#html-tab-view


Grzegorz Bujański staff commented 2 years ago

Yes. From what I can see, the validation is now working properly


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 4.2.0
  • Device: Pc
  • Browser: Chrome 97.0.4692.99
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes