CF8 switch of autocomplete on form

pimh 15h ago

Hi Max, 

Is there a method to switch off the auto complete for a complete form? Normally you can put autocomplete="off" in the form tag as additional attribute. Is there a way to insert this. 

Kind regards, Pim 

Max_admin 3h ago
Answer

Hi Pim

a global autocomplete="off" on the form tag may or may not be respected by the browser, I think the following code inside a JavaScript view in your form page should auto add it:

document.addEventListener("DOMContentLoaded", function () {
    document.querySelectorAll("form").forEach(f => f.setAttribute("autocomplete", "off"));
    document.querySelectorAll("input, select, textarea").forEach(el => el.setAttribute("autocomplete", "off"));
});
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.