Topic: How should dynamic inputs be initialized when reopening a modal?
Emma Collins
free
asked 3 weeks ago
Each modal opening replaces its form content. Static inputs work, but the replacement fields sometimes fail during initialization.
Should old component instances be disposed before rendering new wrappers?
Igor Przybysz
staff
answered 3 weeks ago
Treat each replaced form as a new set of DOM elements. Do not reuse an input element or component instance captured during the previous opening. Once the replacement content is attached, initialize its .form-outline wrappers, using getOrCreateInstance to avoid creating another instance for an unchanged wrapper.
Clean up the instances and any application event handlers you own before discarding their old elements. Please share the code that replaces the modal body and identify whether you keep or recreate the modal container itself. Those details are needed to recommend the correct cleanup point without breaking the modal instance.
https://mdbootstrap.com/docs/standard/forms/input-fields/
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 9.2.0
- Device: Laptop
- Browser: Edge
- OS: Windows 11
- Provided sample code: No
- Provided link: No