Topic: Form controls not working in Modal priority asked 2 years ago

Hi Friends,

Form controls not working in modal, When you want to do form submit using modal.

    document.querySelectorAll('.form-outline').forEach((formOutline) => {
      new mdb.Input(formOutline).init();

    document.querySelectorAll('.datepicker').forEach((formDatepicker) => {
      new mdb.Datepicker(formDatepicker).init();  

mdb.Input is working but datepicker not works for me.

If someone can give me better idea then it is very helpful for our future work.

Thank You! priority answered 2 years ago

Hi @kpienkowska

Thank you for replying me. It was very helpful your snippet.

I have finally found the solution in my code. Basically we have to add modal html code before add script mdb.min.js in the page. so that it initialise to modal elements.

That was the solution in my case. no need to manually initialise etc.

Thank you very much for help me.

Kamila Pieńkowska staff answered 2 years ago

I checked and everything works for me without the need to initialize via JS:

Create a snippet in which the error you are talking about will appear, we will check what is happening.

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 4.0.0
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No