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
Dragon SlayerDragon Slayer 

Text field not displaying on Visualforce page

I am trying to display a text field ,'RESOURCE', from the master object (this text field is manually entered on the VF page associated to the master object). This needs to be displayed on another VF page associated to the child object. So, I have written a code like this on the VF page(related to child object):

<apex:pageBlockSection id="DetailsSection" columns="1"><apex:outputField id="Resource" value="{!Child_Object__c.Master_Object__r.Resource__c}"/></apex:pageBlockSection>

But, when I open the VF page, the value doesn't appear however once I save the page after entering the rest of the details and reopen it the value appears.
Ramu_SFDCRamu_SFDC
That might be because by that time you might have not selected a master record, so the field will not no which master record to fetch the value from hence it will be blank. Hope this helps.
Dragon SlayerDragon Slayer
No, I have a button on the master VF page from where I redirect to the child VF page and I am also displaying the name of the master record on the same page like this and it works but it doesn't work for the text field.

<apex:pageBlockSection id="DetailsSection" columns="1"><apex:outputField id="MasterName" value="{!Child_Object__c.Master_Object__r}"/></apex:pageBlockSection>
Shivani DesaiShivani Desai
Am facing the same problem. Could you please tell me how to resolve this issue?

I have a button which creates a child object and get the parent object's record id but no other fields from the parent make it through.