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
ChubbyChubby 

How to display the rendered field exactly below the other field based on which rendering

Hi,

I am rendering a picklist field based on text field null or not. I want the rendered field exactly below the text field. To achieve this I am using PageblocksectionItem and Panelgrid but this is interrupting alignments. Can any one suggest other ways without interrupting the alignments.

Thanks.
Best Answer chosen by Chubby
Pradeep SinghPradeep Singh
Hi Chubby, 
Refer below code.Here I have pageBlockSection with 2 columns and I have displayed Rating field under the AccountName field by just passing an outputText field for 2nd column.

<apex:pageBlockSection columns="2">
<apex:inputField id="account__name" value="{!Account.Name}" />
<apex:outputtext />
<apex:inputField value="{!Account.Rating}" rendered="{!Account.name != Null}"/>
</apex:pageBlockSection>

Please let me know if this works.

All Answers

Pradeep SinghPradeep Singh
Hi Chubby, 
Refer below code.Here I have pageBlockSection with 2 columns and I have displayed Rating field under the AccountName field by just passing an outputText field for 2nd column.

<apex:pageBlockSection columns="2">
<apex:inputField id="account__name" value="{!Account.Name}" />
<apex:outputtext />
<apex:inputField value="{!Account.Rating}" rendered="{!Account.name != Null}"/>
</apex:pageBlockSection>

Please let me know if this works.
This was selected as the best answer
ChubbyChubby
Hi Pradeep,

Thanks for your response. I tried your code this is similiar to what I need. But the issue is if I have more fields on the page the positions got changed. Plese see below and suggest.

User-added imageI need Rating field should be always under Account Name.

Thanks.
ChubbyChubby
Hi Pradeep,

After few modifications I could resolve this. Thanks you very much for your help.

Thanks.