function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
onlinenandaonlinenanda 

Dynamic inputField type in Datatable

I need to construct table with input fields in following code

 

    <apex:dataTable value="{!udas}" var="uda" cellPadding="4"     border="1">
    <apex:column >
    <apex:facet name="header" >Name</apex:facet>
    {!uda.udaName}
    </apex:column>
    <apex:column >
    <apex:facet name="header" >Type</apex:facet>
        {!uda.udaType}
    </apex:column>
    <apex:column >
    <apex:facet name="header" >Value</apex:facet>
    <apex:XXX  value="{!uda.value}" />
    </apex:column>
     </apex:dataTable>

 In above piece of code  apex:XXX should be decided based on {!uda.udaType},

for Example

if it is boolean then field should be checkbox, if it is string then field should be inputText

Any ideas

Best Answer chosen by Admin (Salesforce Developers) 
Ron HessRon Hess

here is how i do this

 

 

<apex:column >

<apex:selectRadio value="{!si.response.Response_Number__c}" rendered="{!si.question.Type__c == 'Radio'}">

<apex:selectOptions value="{!RadioItems}"/>

</apex:selectRadio>

<apex:inputField value="{!si.response.Response__c}" rendered="{!si.question.Type__c == 'String'}"/>

</apex:column>

 

 

Message Edited by Ron Hess on 03-03-2009 12:00 PM