This topic is locked
[SOLVED]

 Disable Browser Autocomplete for Input Forms

6/14/2018 1:30:34 AM
PHPRunner General questions
S
seedavidwork author

I am trying to determine a way to force the browser to disable autocomplete for my input forms. When connecting to my application using Chrome, the browser wants to suggest autocomplete suggestions for each of the typical fields. This is frustrating as most of the date is unique for each record. In one example I have a field to enter a date and Chrome wants to suggest several recent dates I have entered.
I know you can toggle this off on the browser side, but I have read several articles like this one

https://www.scotsscripts.com/blog/html-css-trick-how-to-turn-off-auto-complete.html

which suggest it can be embedded into the web code.
I need some advice on where to add some specific code to disable browser autocomplete for my application. I have tried inserting a few of the jscript examples in the page load event without success and I've also tried adding a few of the examples to the page HTML.

admin 6/14/2018

You can do that using Javascript OnLoad event of the page in question. Here is the code:

// disable autocomplete for specific field

var field="EmployeeID";

$("[id^=value_"+field+"]").attr('autocomplete','off');
// disable autocomplete for all fields on the page

$("[id^=value_]").attr('autocomplete','off');
S
seedavidwork author 6/15/2018

This solution worked perfectly!