0

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
</apex:inputField>

Thanks, Joe

1 Answer 1

2

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

html-placeholder="Type to Search.."
6
  • where would I place that?
    – tjcinnamon
    Commented Mar 28, 2016 at 18:40
  • As an attribute of the input field, so right after your value but still within the input field. Commented 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
    Commented 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. Commented Mar 28, 2016 at 18:52
  • I'm thinking setting that value in the controller would be a good idea.
    – tjcinnamon
    Commented 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 .