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
lavanya gottumukkalalavanya gottumukkala 

Displaying fields in a field set dynamically in a VF page(Input/Output)

Hi All,

I have one field set in Account object.I want to display some fields in that field set as input fields and some other fields as output fields dynamically in a visualforce page(without hardcoding).How it is possible?Can any one tell me?It's Urgent!

Thanks in advance
Shashikant SharmaShashikant Sharma
Hi,

Not possible directly from field set configurations but you could develop a list configuration parrallel to field set

Field Display Mode - List Custom Setting
It will have tow fields: Field API Name, Display Mode

Query the values of this configuration and use it in your VFP to conditionally render apex:inputField or apex:outputField . Let me knowif you face any issues implementing.

Thanks
Shashikant
Amit Chaudhary 8Amit Chaudhary 8
Hi Lavanya,

Please check below blog to check field set
http://amitsalesforce.blogspot.in/search/label/Field%20Set

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_dynamic_vf_field_sets.htm

Example 1
<apex:page standardController="Contact">
    <apex:repeat value="{!$ObjectType.Contact.FieldSets.properNames}" var="f"> 
        <apex:outputText value="{!Contact[f]}" /><br/>
    </apex:repeat>
</apex:page>

Example 2:- 
<apex:page standardController="Contact">
    <apex:pageBlock title="Fields in Proper Names">
        <apex:pageBlockTable value="{!$ObjectType.Contact.FieldSets.properNames}" var="f">
            <apex:column value="{!f}">
                <apex:facet name="header">Name</apex:facet>
            </apex:column> 
            <apex:column value="{!f.Label}">
                <apex:facet name="header">Label</apex:facet>
            </apex:column> 
            <apex:column value="{!f.Type}" >
                <apex:facet name="header">Data Type</apex:facet>
            </apex:column> 
        </apex:pageBlockTable> 
    </apex:pageBlock> 
</apex:page>

Please let us know if this will help you

Thanks
Amit Chaudhary