You need to sign in to do that
Don't have an account?
logontokartik
Get Field Name API in Visualforce
Is there a way to get the API field name via Dynamic Bindings in Visualforce? I am able to get the Label, but its not allowing me to get the actual API Name.
I need this to dynamically list columns on VF Page and allow them to toggle a Sort.
Below is code snippet: One in red is giving me error.
<apex:repeat value="{!columnFieldsList}" var="flds">
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!toggleSort}" value="{!$ObjectType.Location__c.Fields[flds].Label}" rerender="locationdata">
<apex:param name="sortField" value="{!$ObjectType.Location__c.Fields[flds]}" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!l.loc[flds]}" style="width:30%;"/>
</apex:column>
</apex:repeat>
Correct me if I'm wrong, but isn't flds the API name? I mean, how else would you be retrieving the field's label except by its API name? It seems to me that {!flds} should work just fine.
All Answers
Correct me if I'm wrong, but isn't flds the API name? I mean, how else would you be retrieving the field's label except by its API name? It seems to me that {!flds} should work just fine.
I think I am being silly not trying what you said. Yes you are right, I can use {!flds} to get the fieldname back to the controller.
VF Dynamic Binding rocks!!!!
Thanks fox....