1

How do you pre-populate an inputText field on a Visualforce page? This is for a force.com site.

I understand the controller portion. However, why can I not brute force populate the input field with "Cheese".

There is an id of "name" assigned to the inputText.

Url:

http://testpets.force.com/petname/petname_1?name=Cheese

Visualforce:

<td><apex:inputText value="{!Pet__c.Name__c}" size="50" maxlength="50" styleClass="inputtext" label="Body" id="name"/> </td>
  • 3
    Yes. I have tested this behavior few months back. the only solution I found is using controller to populate the value. – Ratan Paul Mar 23 '16 at 5:24
  • 1
    The only clear and safe solution for pre-populating fields is an apex controller. – Sergej Utko Mar 23 '16 at 8:21
  • @sfdcweb Thank you, I am going to write a controller for this. I wish I could just force it. – All about the W Mar 23 '16 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.