X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    August 12, 2011

Disabling the browser form auto-complete

Frank Nimphius
Master Principal Product Manager

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

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.