You need to sign in to do that
Don't have an account?
neckr
Field Set Labels
I created custom text fields to use as labels to get around the 40 character field constraint. I want to display this associated fields as labels using field sets. I created two field sets, one with the fields and one with the inputtext fields as labels.
My initial thought was two use to repeat functions but it loops around the 2nd field set too many times. Any thoughts on how I can achieve my objective?
<apex:form > <apex:pageBlock title="Without Field Set Use"> <apex:pageBlockSection title="Dynamic Object"> <apex:repeat value="{!$ObjectType.Field_Holder_1__c.FieldSets.ST00192_Labels}" var="fieldlabelAPIName"> <apex:repeat value="{!$ObjectType.Field_Holder_1__c.FieldSets.ST00192}" var="fieldAPIName"> <apex:pageblockSectionItem > <apex:outputfield value="{!sObjectToBind[fieldlabelAPIName]}"/> <apex:inputField value="{!sObjectToBind[fieldAPIName]}"/> </apex:pageblockSectionItem> </apex:repeat> </apex:repeat> </apex:pageBlockSection> </apex:pageBlock> </apex:form>
This is not the way to do
Create A MAP
Map<FieldAPIName , Label> mapgetLabel = new Map<FieldAPIName , Label> ();
use this map like
This will do it for you
Thanks for your help. Can you help with the controller logic to populate the map. I started with something like this, but uncertain on how to link the two field sets in one map.
Any possible help with the controller code?
DO like this , use describe method
Add a public property
Add below code in constructor to get label , please add your labels instead of getting it from field describe as I have shown in example. You have to use label.yuorlabelname in value of map according to field api name.
Use mapgetLabel in VFP
One more way could be check API name in IF condition in VFP in repeat of field set and set value of label accordingly
This is easier also
I am beginning to wrap my head around your suggested code, thanks for your help.
However my Map isn't being populated as it is not identifying the key (field set fields).
I also have a specific naming convention for the associated label field that I am trying to use to keep everything dynamic.
Just to clarify, my asscoaited label fields are text fields with default read only values to be used as the labels.
I am not clear on how to use label.yourlabelname. I highlighted the areas in the code that address comments above.
Any possible suggestions at this stage?
Did you come up with a solution for this issue.. I have the same requirement now.
I would really appreciate if you could help me out.
Thanks!
http://www.salesforce.com/us/developer/docs/pages/Content/pages_dynamic_vf_components_intro.htm
I hope this helps.
It will greatly help me out!
I dont have much time to make my code more baord friendly at this very moment, but let me know if this helps or if you have any questions. I have pasted the snippets of the controller and visuaforce page that pertains to dyanamic visualforce