You need to sign in to do that
Don't have an account?

Dynamic Fields on VF page
Hi,
Suppose I have the list of fields of an Object using:
Map<String, Schema.SObjectField> FMap = Schema.SObjectType.CustomObject__c.fields.getMap();
CustomObject__c tempRecord=new CustomObject__c();
List<String> mainList=new List<String>();
Set<String> tempSet=FMap.keySet();
for(String s:tempSet)
mainList.add(s);
Now, Can you show all these fields on the VF page in Input mode ?
In other words, assume the first field is Text, so I should get <apex:inputText>. At present, we can assume that all fields are text.
what can be possible VF code. I was thinking something with the repeat tag.
Hey,
You can use dynamic components. So creating the controls in the controller and applying the fields to the controls you need.
A basic example is below:
Something along these lines should work. Its hard to give a complete answer without more code.
Cheers,
Adam
Hi,
Yes you are right. Try that in repeat tag
<apex:repeat value="{!mainList}" var="ml" >
<table>
<tr>
<td style="width:95px;border-bottom:1px solid #E3DEB8;">
<apex:inputText value="{!ml}" style="width: 95px;"/>
</td>
</tr>
</table>
</apex:repeat>
If this post solves your problem , please mark it as solution.
Thanks