function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RP2RP2 

Visualforce variables and prepopulating fileds

How can a varible be prepopulate on a visual force form?

 

<apex:pageBlockSectionItem >
          <apex:outputLabel value="First Name"></apex:outputLabel>
               <apex:inputText value="{!firstname}"/>
          </apex:pageBlockSectionItem>
 <apex:pageBlockSectionItem >

 

How can the variable {!firstname} in the above example be prepopulated?

 

Something like..

 

<apex:param name="firstname" value="{!Opportunity.Account.Contact.Fristname" />

 

Mohith Kumar ShrivastavaMohith Kumar Shrivastava

In the Getter method you can return the String You like to be prepopulated.

 

public String getSearchText() {
        return 'Hello';
    }

    public void setSearchText(String s) {
        searchText = s;
    }

 

You may also set the Value in constructor to return the default as Your String.