Topic: Form field from AJAX
MyHomeTendance
pro premium priority asked 4 days ago
I don't anderstand how to generate an form field return by ajax.
The input, select, select multiple does not work and stay standard form field.
I try
document.querySelectorAll(".form-outline").forEach((formOutline) => { new mdb.Input(formOutline).init(); });
AND
selectEl = document.getElementById("xxx"); select = new mdb.Select(selectEl);
But i have the error "mdb.Input is not a constructor" or mdb.select is not a constructor...
With MDB4 i call .materialSelect(); and done ..
How to generate form in ajax with MDB5 ?
Is it possible to listen the dom change and apply the same comportement than a standard page .. all the object auto generated ?
Thank
Open
- User: Pro
- Premium support: Yes
- Technology: MDB 5
- MDB Version: 3.2.0
- Device: all
- Browser: all
- OS: all
- Provided sample code: No
- Provided link: No
Grzegorz Bujański staff commented 3 days ago
I created a snippet in which input initialization and dynamically generated select (via JS) work. It is available at this link: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/2952791#html-tab-view Can you create an example where this error occurs?
MyHomeTendance pro premium priority commented 3 days ago
it seems that the problem comes from the version generated with webpack ... All "new mdb.xx calls fails .. "mdb is not defined"
What am i doing wrong : download mdb-webpack-starter from github npm install git+https://oauth2:ACCESS_TOKEN@git.mdbootstrap.com/mdb/standard/mdb-ui-kit-pro-advanced npm run buildMDB