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

Generic Fields and Objects in visualforce <apex:inputText>
Hi All,
I saw a lot of posts here regards the <apex:inputField> binding to sObject, unfortunately I couldn't understand if it's possible or not to do the following -
Declare in the controller on the following two String parameters -
String objName = 'Account' ; // Or another custom or standard object
String fieldName = 'Industry' ; // Or another custom or standard field
And the output in the visualforce page suppose to show this field by <apex:inputField value="{!objName.fieldName}" />
I tried to use sObject, ObjectType all the describe methods for object and fields without any success to do it.
Any help will highly appriciated,
Thanks in advance,
Hi,
I dont think it is possible.
Alternative is, you can make use of field set. In Field Set, you can display fields of relative objects. You can render the same using input text in VF page.
Thanks
//Apex code
public Account accountInstance{get;set;}
//VF page
<apex:inputField value="{!accountInstance.Industry}"/>
Similarly, you can write for all standard and custom objects.