2

HTML5 introduced a nice form input attribute called autocomplete. When you mark the input field with autocomplete="on" each value ever entered in the browser to that field will be automatically cached and displayed when you fill the form again. My question, why apex:inputField does not support that? it should reflect any attribute supported by HTML5 doesn't it?

1 Answer 1

3

You can add attributes to many Visualforce components that are “passed through” to the rendered HTML. To add a pass-through attribute to, for example, an <apex:inputText> component, prefix the attribute with “html-” and set the attribute value as normal. This link describes in detail.

<apex:inputText value="{!account.owner.name}" html-autocomplete="on"/>

As per Salesforce documentation, Pass-through attributes are supported by <apex:inputField>

3
  • It answers the question although the autocomplete is not working... I can see that the generated input field contains autocomplete="on" , very strange, do you know why?
    – Uri Lukach
    Oct 1, 2015 at 19:46
  • As per w3schools, In some browsers you may need to activate an autocomplete function for this to work (Look under "Preferences" in the browser's menu). Can you check your setting computerhope.com/issues/ch000604.htm.
    – Saroj Bera
    Oct 1, 2015 at 19:58
  • It is turned on, in w3schools the autocomplete on is working fine in my Chrome browser, although in SalesForce site under SSL it simply fails to work... I am not sure why...
    – Uri Lukach
    Oct 1, 2015 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .