+ Start a Discussion
Chris987654321Chris987654321 

Remove the Required Information from a <apex:pageblocksection>

Is it possible to remove the Required Information part on a Visual Force page? When you add a <apex:pageblocksection> it automatically puts a line that says Required Information on the first pageBlockSection. I want to remove it because I read that you cannot easily put that red line on custom text fields like <apex:outputText>. So I didn't want to confuse the user by saying that the red line denotes a required field.

Best Answer chosen by Admin (Salesforce Developers) 
michaelforcemichaelforce

Is the "mode" of the PageBlock set to "edit"?  If so, you can try switching it to "detail" to see if that gets rid of the required legend thing.  Otherwise, a quick and dirty hack to put the red line on an input element (like input text) is:

 

 

style="border-left:3px solid red"

 

 

All Answers

michaelforcemichaelforce

Is the "mode" of the PageBlock set to "edit"?  If so, you can try switching it to "detail" to see if that gets rid of the required legend thing.  Otherwise, a quick and dirty hack to put the red line on an input element (like input text) is:

 

 

style="border-left:3px solid red"

 

 

This was selected as the best answer
prageethprageeth

Hello; 

If you want to show your own field as a required field(visually) you can wrap your component with <div> s as below.

For an example following <apex:inputText/> looks as a required field with red left line.

 

 

<div class="requiredInput"><div class="requiredBlock"></div>
     <apex:inputtext value="{!Opportunity.orderNumber__c}"/>
</div>

 

if you want to remove the red line you can do it by adding the following code to your VF page and by changing the "background-color" to the color of your page block.

 

<style>
    .bPageBlock .requiredInput .requiredBlock {
        background-color:blue;
    }
</style>

 

Chris987654321Chris987654321

Thank you very much. I was actually looking for a way to put the red line on my field. That worked great.

Jeff BergerJeff Berger
I know this is over 6 years old but for those coming along later:
if you do actually want to remove the required info block you can simply use 
<style>
    .pbSubExtra {
    display:none;
    }
</style>