reset form

MarcRohrer pro premium priority asked 3 weeks ago

what is the correct way to reset a whole form to its defaults?

robbyirish pro premium priority commented 3 weeks ago

with jQuery I use $('#formID').trigger("reset");

Dawid Wajszczuk staff answered 3 weeks ago


The best way would be to write the whole logic for this in JS. Second option, dispose all pieces of this form and reinitialize them. And the last solution that comes to my mind (and the simplest) would be to try using this (I'm not fully aware how well it works with our kit but you can give it a try).

Keep coding,

MarcRohrer pro premium priority answered 3 days ago


I have a working version, thank you. Now I am working on loading data into the form, got from server via fetch. Works fine, but in the end the labels stay inside the edit elements. What function do I use to update that?



Dawid Wajszczuk staff commented 2 days ago

Hi. Try this code and let me know if this works.

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

Please insert min. 20 characters.


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