Is there a way to hardcode a saveable value into a control in a visualforce page without javascript?

Example: If I wanted to automatically have this field start with some text that I want to populate', how would I go about having the field start with that value?

<apex:inputField value="{!Survey__c.Additional_Indicators__c}" >
    some text that I want to populate

Thanks, Joe

1 Answer 1


Should just be able to define it as an HTML5 attribute like this:

html-placeholder="Type to Search.."
  • where would I place that?
    – tjcinnamon
    Mar 28, 2016 at 18:40
  • As an attribute of the input field, so right after your value but still within the input field. Mar 28, 2016 at 18:42
  • ahhh, what if I want that value to be save-able and not a help text? I edited my above example to make that more explicit.
    – tjcinnamon
    Mar 28, 2016 at 18:43
  • 1
    That value will be whatever that variable is defined as in the controller when that page renders. So if you want default values in those, you'd either want to set those in your controller, or you could use jquery to inject values into those fields after the page renders. Really depends on your situation. Mar 28, 2016 at 18:52
  • I'm thinking setting that value in the controller would be a good idea.
    – tjcinnamon
    Mar 28, 2016 at 18:56

You must log in to answer this question.

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