Disable auto-completion
-
Hello,
Is it possible to disable the auto-completion of the browser history in a form field?
Thanks You
-
Hello @massdoo11 !
I trust you’re doing well!
Forminator doesn’t have a built-in option for that, but you can try the following script:
<?php add_filter( 'forminator_render_form_markup', function( $html, $fields ) { return str_replace( array( '<input', '<form' ), array( '<input autocomplete="off"', '<form autocomplete="off"' ), $html ); }, 10, 2 );To install the script, please copy the code to a .php file and place the file in wp-content/mu-plugins directory (please create the directory if it doesn’t exist).
This snippet will disable autocompletion on all Forminator forms, in all fields.
Best regards,
PawelThank you for your message,
I just added the code in the folder
But it doesn’t work :/Image of code : https://ibb.co/BGCNJ31
Thanks
I would like the auto-complete to be disabled mainly on an address field:
<input autocomplete=”off” type=”text” name=”address-1-city” placeholder=”Par exemple : Paris, Lyon, Lille” id=”forminator-field-cityaddress-1″ class=”forminator-input pac-target-input” data-required=”1″ aria-required=”true” value=”” aria-invalid=”true”>
However the auto-complete is well off
UPDATE :
In the Chroome console, I changed “off” to “new-password” and it works. (screen https://ibb.co/87pHjhf)
So I modified the code :
<?php add_filter( 'forminator_render_form_markup', function( $html, $fields ) { return str_replace( array( '<input', '<form' ), array( '<input autocomplete="new-password"', '<form autocomplete="new-password"' ), $html ); }, 10, 2 );Off by new-password, but the field still remains in “auto-complete:off”
Thanks
Hi @massdoo11
If you have modified the code but it remains the same on the page (in page source) then it means usually that cache is serving “old” version of the page.
Make sure that all the cache (on site/server/CDN if there is any) is cleared and, just in case, you may also either clear browser cache or test in incognito browser tab after that. Purging all caches should get the change applied.
Kind regards
AdamThannks, The code doesn’t seem to work, it doesn’t disable autocompletion…
Hi @massdoo11
I’m sorry but I’m a bit confused now:
– the original code that Pawel shared doesn’t work?
– or your modification is still not applied (the one that apparently worked for you when added via Chrome browser)?I’ve just tested Pawel’s code on my test site and it worked as expected there so either it’s still not applied correctly or there’s something in addition that’s breaking it.
I think you have tried to add that code using some sort of “php snippet” plugin, right?
Can you instead try to add it “manually”?:
– create an empty file with a .php extension (e.g. stop-autocomplete.php)
– copy and paste code that my colleague shared earlier – exactly as it is – into it
– save the file
– upload it to the “/wp-content/mu-plugin” folder of your site via FTP, Cpanel “File Manager” or similar wayOnce it’s there, again clear all cache on site/server and check if it works then, please.
Kind regards,
AdamPawel’s code.
I put the code in a .php file in the /wp-content/mu-plugins folder.
It appears well in my list of extensions, I also cleared my cache.
Do you have an email address so that I can send you the address of our form and more sensitive data?
thank you
Hi @massdoo11
Could you export the form and share it in the next reply?
In order to export this form, you can go to the WordPress dashboard > Forminator Pro > Forms, and next to the Edit button you’ll find the Settings wheel. Click on it, and on the menu select Export. Once the Export Form window is opened, you’ll see the Download button.
You can save the generated TXT file in Google Drive or Dropbox and then share with us the URLs so we may look into this.
Also, share in Google Drive or Dropbox your PHP file which code. We will double-check on our side, does everything is ok.Kind Regards,
KriThank you for your help,
Here are the requested information
https://www.dropbox.com/sh/nj7f9j30sho9h2r/AADB-QCJUI3M9MT1iGk0gyTna?dl=0
Kind Regards,
Any news ?
Thanks 🙂
Hi @massdoo11,
Thanks for sharing the form export. I tested the form in my test server with the snippet that we initially shared in here:
https://ww.wp.xz.cn/support/topic/disable-auto-completion/#post-15303175And can confirm it works out of the box in Chrome, Firefox. Are you able to replicate the issue on other browsers? or is it more specific to Chrome on your side?
Could we know the version of the browser you are testing on? Also, if possible please share a screenshot of what you notice on your side, so that it might help us give a better idea regarding the issue too.
Looking forward to your response.
Kind Regards,
NithinHello,
It’s strange,
Chrome : Version 98.0.4758.82
Here is the screen : https://ibb.co/PQHtH95Do you have an email address so that I can send you privately the address of my site with the form ?
Thank you in advance
Hi @massdoo11
Would it be possible to send the Form link?
You can configure a temporary page.
Best Regards
Patrick Freitas
The topic ‘Disable auto-completion’ is closed to new replies.