+ Start a Discussion
satheesh8.k1.3890099515516848E12satheesh8.k1.3890099515516848E12 

fieldsets

Hi

I wrote this code about fieldsets ,which is working fine , but here that field related text box only appear  ,i need to display label name with text box.
please any one help me how to display label name.

<apex:page standardController="Account">
<apex:form >
<apex:repeat value="{!$ObjectType.Account.FieldSets.TestforFieldSet}" var="pi" > 
        <script>alert('{!pi}');</script>
        <option value="{!$ObjectType.Account.Fields[pi].localname}" />
        <option value="{!$ObjectType.Account.Fields[pi].label}" />
      <apex:inputField value="{!Account[pi]}" />         
</apex:repeat>
</apex:form>
</apex:page>
Best Answer chosen by satheesh8.k1.3890099515516848E12
Shaijan ThomasShaijan Thomas
<apex:page standardController="Account">
<apex:form >
<apex:pageblock >
<apex:repeat value="{!$ObjectType.Account.FieldSets.TestforFieldSet}" var="pi" > 
        <script>alert('{!pi}');</script>
        <option value="{!$ObjectType.Account.Fields[pi].localname}" />
        <option value="{!$ObjectType.Account.Fields[pi].label}" />
        <apex:pageBlockSection >
      <apex:inputField value="{!Account[pi]}" />  
      </apex:pageBlockSection>    
</apex:repeat>
</apex:pageblock>
</apex:form>
</apex:page>

Try this, if its useful, make it a best answer
Thanks
Shaijan

All Answers

Shaijan ThomasShaijan Thomas
<apex:page standardController="Account">
<apex:form >
<apex:pageblock >
<apex:repeat value="{!$ObjectType.Account.FieldSets.TestforFieldSet}" var="pi" > 
        <script>alert('{!pi}');</script>
        <option value="{!$ObjectType.Account.Fields[pi].localname}" />
        <option value="{!$ObjectType.Account.Fields[pi].label}" />
        <apex:pageBlockSection >
      <apex:inputField value="{!Account[pi]}" />  
      </apex:pageBlockSection>    
</apex:repeat>
</apex:pageblock>
</apex:form>
</apex:page>

Try this, if its useful, make it a best answer
Thanks
Shaijan
This was selected as the best answer
satheesh8.k1.3890099515516848E12satheesh8.k1.3890099515516848E12
Hi 
Shaijan Thomas,

 i need to understand is when to use fieldsets ,could you please explain one realtime senario ,and is there any limitations means how many fields we can put it in fieldsets.

Thanks
Satheesh
Shaijan ThomasShaijan Thomas
1. Groping of fields - Maintain the consistancy across the application ex. Address Structure
2. In manged packages , If you used field set in visualforce pages, administrators can easily add, remove and reorder fields in page. No need to do code change
3. How many fields I do not know.
Thanks
Shaijan Thomas