4

For the required fields on my page, I'm getting the red bar next to the fields that indicate they are required but not the directions at the top of the page which says 'red bar' = required information. I am including my mode = "edit" in my <apex:pageblock> ... ideas?

according to this site, that should do it... http://boards.developerforce.com/t5/Visualforce-Development/How-to-display-quot-Required-information-quot-on-the-Page-Block/td-p/110572

<apex:page standardController="Event" extensions="EventExtension" tabStyle="Event" >
    <apex:sectionHeader title="Calendar" subtitle="{!IF(ISNULL(Event.Subject),'New Event',Event.Subject)}" />
    <apex:form >
    <apex:pageBlock title="Event Edit" mode="edit"  >

        <apex:pageBlockButtons >                  
        </apex:pageBlockButtons>

        <apex:pageBlockSection ></apex:pageBlockSection>


    <apex:pageBlockSection title="Calendar Details" columns="2">         
        </apex:pageBlockSection>

        <apex:pageBlockSection columns="1">               
        </apex:pageBlockSection>

        <apex:pageBlockSection title="System Information" columns="2">       
        </apex:pageBlockSection>


    </apex:pageBlock>
    </apex:form>
</apex:page>

3 Answers 3

1

This code works for me. I think the solution is that you need to add a title to the first pageBlockSection. I can't explaint this issue, but if i put the first pageBlockSection without any title - the "= Required Information" label disappears:

<apex:page standardController="Event" extensions="EventExtension" tabStyle="Event" >
    <apex:sectionHeader title="Calendar" subtitle="Subtitle" />
    <apex:form >
    <apex:pageBlock title="Event Edit" mode="edit"  >

        <apex:pageBlockButtons >                  
        </apex:pageBlockButtons>

        <apex:pageBlockSection title="Calendar Details">         
        </apex:pageBlockSection>

    </apex:pageBlock>
    </apex:form>
</apex:page>
2
  • thats so weird... Commented Jun 21, 2013 at 17:57
  • @mast0r For me, Required Information is appearing only for first pageblocksection.
    – Sanjivani
    Commented Mar 21, 2015 at 13:32
0

please add mode="edit" to and it should display = required information

  </apex:pageBlockSection>

0

It is a weird issue that even after having mode = "edit" in apex:pageBlock the | = required information is only showing for first apex:pageBlockSection

so if you want to add | = required information only for the one apex:pageBlockSection then mode = "edit" will work, but if you want to go further into this, then just create a makeshift like

  1. add a id to apex:pageBlockSection

     <apex:pageBlockSection  id="second_section" columns="2" title="This will WORK" collapsible="false" showHeader="true" >
    
  2. now get the id using inspect element enter image description here

  3. now just create the | = required information part using javascript in visualforce page

      window.onload = function() {
          var secondSection = document.getElementById('j_id0:j_id2:j_id30:second_section');
          var headerDiv = secondSection.children[0];
          headerDiv.innerHTML += '<span class="pbSubExtra"><span class="requiredLegend"><span class="requiredExampleOuter"><span class="requiredExample">&nbsp;</span></span><span class="requiredText"> = Required Information</span></span></span>';
    
      };
    

The output will be something like this enter image description here

You must log in to answer this question.

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