Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a VisualForce form that includes a phone number input. I want to turn off Autocomplete on this input based on an incoming URL parameter.

This is what I have now:

<apex:inputText value="{!phone}" styleclass="phone" id="phone" maxlength="16"  />

And I need something like this, I think:

<apex:inputText value="{!phone}" styleclass="phone" id="phone" maxlength="16" autocomplete="{!IF($CurrentPage.Parameters.phoneac == 'false'),"off","")}" />

But it doesn't seem to work this way. What am I missing?

It might be that autcomplete is not a valid field for VisualForce?

share|improve this question
up vote 6 down vote accepted

OK, pleased to announce I solved my own question. There were two issues.

  1. I had a misplaced ')' in my code. Don't need that extra paren.

  2. It's quite true that autocomplete is not valid field for VisualForce. But there's a handy prefix 'html-' that allows many fields to be passed through to the page. That worked to get the autocomplete attribute through.

So the working code is:

<apex:inputText value="{!phone}" styleclass="phone" id="phone" maxlength="16"  html-autocomplete="{!IF($CurrentPage.Parameters.phoneac == 'false',"off","on")}" />

Thanks for following along.

share|improve this answer
Just wanted to say thanks for sharing your answer! Took awhile for us to find an easy solution and we were just about to implement a much longer way of getting this done. Signed up for salesforce.stackexhange and got my rep up enough to be able to comment, just so I could say thanks! :) – Jenny B Jul 3 '14 at 19:45
Cool, glad it helped! And thanks for the + – Tony Brasunas Jul 7 '14 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.