Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable autocomplete in <h:inputText>?

I'm making my term paper using JSF 2.0, Java 6 and Tomcat 7, but I'm having some doubts in the development.

In my project I have a <h:inputText> tag

<h:inputText value="#{turmaMBean.nome}">
    <f:ajax event="keyup" render=":meuForm:minhaTabela" />
</h:inputText>

I want to disable autocomplete. I already tried:

<h:inputText value="#{turmaMBean.nome}" autocomplete="false">
    <f:ajax event="keyup" render=":meuForm:minhaTabela" />
</h:inputText>

However, it didn't work. What can I do to solve this problem?

like image 270
Paladini Avatar asked Nov 16 '13 19:11

Paladini


People also ask

How to disable autocomplete in input?

- The Web Dev How to disable autocomplete in input? Sometimes, we want to disable autocomplete in input. In this article, we’ll look at how to disable autocomplete in input. How to disable autocomplete in input? To disable autocomplete in input, we can set the autocomplete attribute to off. to add an input with autocomplete disabled.

How do I use the autocomplete attribute in HTML?

The autocomplete attribute works with the following <input> types: text, search, url, tel, email, password, datepickers, range, and color. Let’s see an example where the autocomplete is set to "off" for the whole form and two <input> elements. Example of using the autocomplete attribute with the "off" value: ¶

What does autocomplete = off mean?

If a site sets autocomplete="off" for username and password <input> fields, then the browser still offers to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits the page.

Why can't I set autocomplete for login fields?

For this reason, many modern browsers do not support autocomplete="off" for login fields: If a site sets autocomplete="off" for a <form>, and the form includes username and password input fields, then the browser will still offer to remember this login, and if the user agrees,...


1 Answers

I found the answer. I searched a lot about this issue and I discover this isn't an issue. When I try to do the following:

<h:inputText value="#{turmaMBean.nome}" autocomplete="off">
        <f:ajax event="keyup" render=":meuForm:minhaTabela" />
</h:inputText>

I didn't restart my Tomcat Server, and by some strange way Tomcat doesn't updated my view properly. When I tried to restart the server, this attribute start work.

So, if you need to turn the autocomplete off, use:

autocomplete="off" 

This probably will work - don't forget to restart the server, sometimes Tomcat like play with us :p.

like image 89
Paladini Avatar answered Oct 19 '22 18:10

Paladini