Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Manish Kumar Jaiswal
How can I disable auto-complete ?
February 28, 2011 1:33 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 132

Join Date: November 25, 2008

Recent Posts

How can I disable auto-complete in Liferay which is making my browser to remember my passwords .?????????


Regards
Manish
Raja Nagendra Kumar
RE: How can I disable auto-complete ?
February 28, 2011 1:43 AM
Answer

Raja Nagendra Kumar

Rank: Expert

Posts: 484

Join Date: March 1, 2006

Recent Posts

Not sure if one can do any thing related to smartness browsers are trying to add..

You could try the input fields with different names instead of username, password etc..so that, they treat that page as any other field etc.
Ravi Kumar Gupta
RE: How can I disable auto-complete ?
February 28, 2011 2:04 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1137

Join Date: June 23, 2009

Recent Posts

Manish Kumar Jaiswal:
How can I disable auto-complete in Liferay which is making my browser to remember my passwords .?????????


I might be wrong but here are the ideas..

1. Probably clearing the form fields before sending to server can help. emoticon
In detail writing the program such that when a user submits the form, program will first store all the values in local variables, clear all form fields and then send to server (javascript can do so..). So it will be like ur form was submitted but with empty fields.. Hidden fields can help in this case.. emoticon
I guess bank sites do something like this..

2. Knowing how browsers clean the history; if using javascript some how we can clear the browser's form history then...

3. If you are using a portlet.. surely in portlet at the time of view we can set a dummy string which is sent to view jsp. In jsp we can add that string to all the names of form fields for ex. if form has fields with name age, address etc and random dummy string is QWERT then age_QWERT, address_QWERT may be the names of fields.. and because everytime this will be a new field name so browser may not cache..

now when we already know the string we can add that while receiving the parameters in process action..

If I am wrong, please do correct..

Thanks and Regards
-Ravi Kumar Gupta
TechD of Computer World
Manish Kumar Jaiswal
RE: How can I disable auto-complete ?
March 4, 2011 1:11 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 132

Join Date: November 25, 2008

Recent Posts

Just did it...I added following lines at last of login.jsp


<script type="text/javascript">

window.onload = function() {
for(var i = 0, l = document.getElementsByTagName('input').length; i < l; i++) {
if(document.getElementsByTagName('input').item(i).type == 'text') {
document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');
};
};
};

</script>
Ravi Kumar Gupta
RE: How can I disable auto-complete ?
March 6, 2011 8:55 PM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1137

Join Date: June 23, 2009

Recent Posts

Didn't know this attribute, Good to know.

More on this here How to Turn Off Form Autocompletion

Thanks Manish.
Daniel Dan
RE: How can I disable auto-complete ?
November 7, 2011 2:50 AM
Answer

Daniel Dan

Rank: New Member

Posts: 3

Join Date: April 19, 2011

Recent Posts

Manish Kumar Jaiswal:
Just did it...I added following lines at last of login.jsp


<script type="text/javascript">

window.onload = function() {
for(var i = 0, l = document.getElementsByTagName('input').length; i < l; i++) {
if(document.getElementsByTagName('input').item(i).type == 'text') {
document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');
};
};
};

</script>



Works fine! emoticon
Puneet Upadhyay
RE: How can I disable auto-complete ?
April 19, 2012 11:38 PM
Answer

Puneet Upadhyay

Rank: Regular Member

Posts: 234

Join Date: October 22, 2011

Recent Posts

Thanks manish.
Ashish Renapurkar
RE: How can I disable auto-complete ?
January 9, 2013 9:15 PM
Answer

Ashish Renapurkar

Rank: New Member

Posts: 23

Join Date: January 18, 2012

Recent Posts

Ravi Kumar Gupta:
Didn't know this attribute, Good to know.

More on this here How to Turn Off Form Autocompletion

Thanks Manish.



Hello Ravi,

This link is now working.
Kindly update .

Regards..
Ashish Renapurkar