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
UrvikUrvik 

Render fields on visualforce based on record type

Hi - I have the the following visualforce page. I have been trying to display fields based on the record type selected. I'm using fieldsets. This is based on one fieldset. I have 10 record types and each has separate page layout. How do I make it dynamic so that based on the record type, it display fields?
 
<apex:page standardController="Auto__c" renderAs="pdf">

 <apex:form >
  <apex:pageBlock title="Details">
      <apex:pageblockSection columns="1">
          
          <apex:repeat value="{!$ObjectType.Auto__c.FieldSets.Cars}" var="f">
                <apex:outputfield value="{!Auto__c[f]}">
                </apex:outputfield>
          </apex:repeat>
  
      </apex:pageblockSection>
  </apex:pageBlock>

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

 
Greg Brown 4Greg Brown 4
You can accomplish this by creating an extension that defines the record type and field sets that you want to display.