Disabling the browser form auto-complete

As often, somebody's heaven is another one's hell. The browser auto-complete functionality is one example for this. In Oracle ADF Faces, there is no property that switches auto complete-off for input field components or the af:form component. Thanks to the ADF Faces client side architecture switching off this browser functionality is easy to achieve:

<af:form> 
  
  <af:clientListener  type="mouseOver"
                      method="suppressAutoComplete"/>
</af:form>

The mouse over event is issued one time when you enter a form. Given that you can only have a single form on a page, this means it fires one time for the page.

The JavaScript function referenced by the af:clientListener element is shown below

function suppressAutoComplete(evt){
 var domElement =
     AdfRichUIPeer.getDomContentElementForComponent(evt.getSource());
 domElement.setAttribute("autocomplete", "off" ); 
}

If you put this into a JS library that you reference from the af:resource tag then all you need to remember is add the af:clientListener tag to the af:form tag.

Update May-2012: Switching off browser suggest functionality is now a native capability of the inputText component in Oracle JDeveloper 11.1.2+ Read about the "autoComplete" property in http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_inputText.html

Comments:

Post a Comment:
Comments are closed for this entry.
About

The Oracle JDeveloper forum ranks in the Top 5 of the most active forums on the Oracle Technology Network (OTN).



The OTN Harvest blog is a summary of selected topics posted on the OTN Oracle JDeveloper forum.



It is an effort to turn knowledge exchange into an interesting read for developers who enjoy little nuggets of wisdom





Frank Nimphius

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today