You need to sign in to do that
Don't have an account?
WEN JIE
Problem when display fieldset on Visualforce
Hi,
I have created two field sets, one is created on standard object, the other one is created on a custom object. So far, I can display them on visualforce separately when I use standard controller.
But I try to display them on the same Visualforce. I have an apex class to display fieldset when I use custom controller.
So, does anyone have experineces about this?
Thank you !
Hi,
Try the below code snippet as reference:
..........
Page
..........
<apex:page standardController="Contact" extensions="Fieldset">
<apex:form >
<apex:pageBlock title="Fields in Proper Names">
<apex:pageblockSection >
<apex:pageBlockTable value="{!$ObjectType.Contact.FieldSets.a}" 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:column value="{!f.DBRequired}">
<apex:facet name="header">DBRequired</apex:facet>
</apex:column>
<apex:column value="{!f.FieldPath}">
<apex:facet name="header">FieldPath</apex:facet>
</apex:column>
</apex:pageBlockTable>
</apex:pageblockSection>
<apex:pageblockSection >
<apex:pageBlockTable value="{!fields}" var="f">
<apex:column value="{!f.FieldPath}">
<apex:facet name="header">FieldPath</apex:facet>
</apex:column>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
...........
Controller
..........
public class Fieldset {
public List<Schema.FieldSetMember> fields{get;set;}
public Fieldset(ApexPages.StandardController controller) {
fields = Schema.SObjectType.Employee__c.fieldSets.getMap().get('Test').getFields();
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.