+ Start a Discussion
Starz26Starz26 

Unable to set values if pageblock section was not rendered on page load

I have a page block section that is not rendered on initial page load. It is using a sObject property on a custom controller

 

i.e. 

 

public Account a {get;set;}

 

If I render the section on load, any values entered will be saved when the user clicks the command button that calls my save method and the fields are populated.

 

If the section is not rendered on page load, all values are null regardless of what the user enters when I render the section.

 

Anyone have any Ideas? I know this is probably basic and I am just missing something here.

Saurabh DhobleSaurabh Dhoble

I don't understand the problem 100%, so if you post your code that would be helpful. However, what if you use the <apex:outputField> to render the values inside the pageblocksection. That way, users cannot edit it and you can control when it gets rendered.