1

I created a controller that stores several values and then redirects the user to a Visualforce Page with those values. My goal is to have the Visualforce input fields populate. The url values populate sucessfully, however the Visualforce page input fields do not prepopulate with the values. Is this not possible?

Example URL from the Controller:

PageReference a = new PageReference('http://test.force.com/test/test_1?Name='+ recordid + '&00N1a000008FU6Z=' + test1 + '&00N1a000008FU6U=' + test2 + '&00N1a000008GViX=' + recordname);

Example Visualforce Page:

<apex:inputText value="{!Test__c.Name__c}" size="50" maxlength="50" label="Body" id="name1"/>

1 Answer 1

2

You can do it by setting the parameters in the constructor of the new page.

an simple example is:

<apex:page controller="testCRTL">
 <apex:form >
     <apex:inputField value="{!acc.name}"/>
 </apex:form> 
</apex:page>

with the controller:

public class testCRTL {
    public Account acc{get;set;}

    public testCRTL(){
        acc = new account(); 
        acc.name=ApexPages.currentPage().getParameters().get('name');
    }
}

with an url like: https://[SFDC instance]/apex/test?name=XXX

You must log in to answer this question.

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