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.

4
  • 1
    use html pass through and html-placeholder="your default text" Commented Jan 11, 2016 at 0:42
  • @JesseMilburn Why dont you add that as an answer .I think that qualifies as answer :) Commented Jan 11, 2016 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
    Commented Jan 11, 2016 at 0:55
  • In that scenario. <apex:inputText value="{!value}"/> Commented Jan 11, 2016 at 1:05

1 Answer 1

5

Use html pass through in your visualforce markup

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

You must log in to answer this question.

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