1

How can it be align to rest of the fields like how it has Start/End date... like to avoid using style like left-padding etc...

Screen shot how it looks after it renders:

enter image description here

Here is my VFP code that renders the above screen shot:

<apex:actionRegion >
    <apex:pageBlockSection title="Status" id="stat" columns="2"   >            
        <apex:inputField value="{!Items__c.Is_Status__c}"> 
            <apex:actionSupport event="onclick" reRender="stat2" />
        </apex:inputField>
    </apex:pageBlockSection>  
</apex:actionRegion>                

<apex:actionRegion >     
    <apex:pageBlockSection id="stat2" columns="2" >

        <apex:inputField value="{!Items__c.Start_Date__c}" rendered="{!Items__c.Is_Status__c}"/>
        <apex:inputField value="{!Items__c.Is_Selected__c}" rendered="{!Items__c.Is_Status__c}" />
        <apex:inputField value="{!Items__c.End_Date__c}" rendered="{!Items__c.Is_Status__c}" />
        <apex:inputField value="{!Items__c.Ranking__c}" rendered="{!Items__c.Is_Status__c}" /> 

        <apex:actionRegion >
        <apex:pageBlockSection columns="1">            
            <apex:inputField value="{!Items__c.Is_Custom_URL__c}" rendered="{!Items__c.Is_Status__c}"> 
                <apex:actionSupport event="onclick" reRender="stat4" oncomplete="alert({!Items__c.Is_Custom_URL__c})" />
            </apex:inputField>
            </apex:pageBlockSection>  
        </apex:actionRegion>

    <apex:pageBlockSectionItem />    
        <apex:actionRegion >
            <apex:pageBlockSection id="stat4" columns="2"   >   
            <apex:inputField required="{!Items__c.Is_Custom_URL__c}"  value="{!Items__c.Host_URL__c}" rendered="{!Items__c.Is_Status__c}"  />
            <apex:pageBlockSectionItem /> 
            <apex:inputField value="{!Items__c.Proxy_URL__c}" rendered="{!Items__c.Is_Status__c}" />
         </apex:pageBlockSection>  
    </apex:actionRegion>

    <apex:pageBlockSectionItem />  

    <apex:inputField style="width: 200px; height: 50px" value="{!Items__c.Description__c}" rendered="{!Items__c.Is_Status__c}" />            
    <apex:inputField style="width: 200px; height: 50px" value="{!Items__c.Short_Description__c}" rendered="{!Items__c.Is_Status__c}" />    

    </apex:pageBlockSection>
</apex:actionRegion>
3
  • 1
    try <apex:pageBlockSectionItem> May 12, 2016 at 20:34
  • 1
    @IlyaLepesh You really should make this an answer.
    – sfdcfox
    May 12, 2016 at 20:41
  • not really works and its messed my formatting with other fields... have you guys tried?
    – Nick
    May 12, 2016 at 20:55

1 Answer 1

3

When you are using actionRegion, you could loose your alignment, use pageBlockSectionItem and outputLabel to display corrrect label for field:

Before changing, remove all your insufficient pageBlockSectionItem

Change:

<apex:actionRegion >
    <apex:pageBlockSection columns="1">            
        <apex:inputField value="{!Items__c.Is_Custom_URL__c}" 
            rendered="{!Items__c.Is_Status__c}"> 
            <apex:actionSupport event="onclick" reRender="stat4" 
                oncomplete="alert({!Items__c.Is_Custom_URL__c})" />
        </apex:inputField>
    </apex:pageBlockSection>  
</apex:actionRegion>

To:

<apex:pageBlockSectionItem rendered="{!Items__c.Is_Status__c}"> 
    <apex:outputLabel for="url" value="{!$ObjectType.Items__c.fields.Is_Custom_URL__c.Label}"/>
    <apex:actionRegion >

        <apex:inputField value="{!Items__c.Is_Custom_URL__c}" id="url"> 
            <apex:actionSupport event="onclick" reRender="stat4" 
                oncomplete="alert({!Items__c.Is_Custom_URL__c})" />
        </apex:inputField>

    </apex:actionRegion>
</apex:pageBlockSectionItem> 

Updated:

<apex:pageBlockSectionItem rendered="{!items__c.Is_Status__c}"> 
  <apex:outputLabel for="Proxy" value="{!$ObjectType.items__c.fields.Proxy_URL__c.Label}" />
  <apex:inputField value="{!items__c.Proxy_URL__c}" id="Proxy"/> 
</apex:pageBlockSectionItem> 
3
  • 1+ Thanks for the markeup but I'm unable to align with the other two Proxy_URL__c /Proxy_URL__c field i have tried all sort of combination but it comes with scattered field and i'm out of ideas now and i need your help if you can
    – Nick
    May 12, 2016 at 23:40
  • 1
    @nick-kahn, please check updated section May 13, 2016 at 0:32
  • 1
    you should wrap it with <apex:pageBlockSection id="stat7" columns="1" > May 13, 2016 at 0:49

You must log in to answer this question.

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