3

I am trying to 'prepopulate' (when the page loads) a visual force textbox:

 <apex:page controller="FedExLabelOverviewController">
   <apex:form >
     <apex:inputText ... />
   </apex:form>
 </apex:page>

with a string value from an apex class (i.e. test.getValue();)

I was wondering how this was done. Can I reference the other class' variable in the controller class of the visualforce page?

Edit: I am using inputText because my intention is to be able to clear the text box when the user wants to type something in. Essentially, I want to set the default value on the input text box.

  • 1
    use html pass through and html-placeholder="your default text" – Jesse Milburn Jan 11 '16 at 0:42
  • @JesseMilburn Why dont you add that as an answer .I think that qualifies as answer :) – Mohith Shrivastava Jan 11 '16 at 0:47
  • @JesseMilburn I don't want help text/placeholder, per se, but I do want to populate the field with actual text. If the field was read by a class, it would return the prepopulated text. – JMK Jan 11 '16 at 0:55
  • In that scenario. <apex:inputText value="{!value}"/> – Jesse Milburn Jan 11 '16 at 1:05
5

Use html pass through in your visualforce markup

<apex:inputText html-placeholder="your default text"/>

Your Answer

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

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