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
Javeed ShaikJaveed Shaik 

I am not able to render a outputPanel based on the picklist Value selection

I am unable to render outputPanel based on the picklist Value selection. Please let me know what is wrong with my code.
Thanks in advancve!!
 
<apex:page standardController="Case" extensions="PublisherController" showHeader="false">
<apex:form >
    <br/><br/><br/><br/>
    <table align="center" width="50%" cellpadding="5">
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Model</apex:outputText>
            </td> 
            <td align="left"><apex:inputField value="{!case.Model__c}"/>
            </td>
            <td align="right" rowspan="2"><apex:outputText >Description</apex:outputText>
            </td>
            <td align="left" rowspan="2"><apex:inputField value="{!case.description}"/>
            </td>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Category</apex:outputText>
            </td> 
            <td align="left"><apex:inputField value="{!case.Category__c}"/>
            </td>
            <td align="right">
            </td>
            <td align="center">
            </td>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Problem</apex:outputText>
            </td> 
            <td align="left">
                <apex:ActionRegion >
                    <apex:inputField value="{!case.Problem__c}"><apex:ActionSupport event="onchange" reRender="ddc"/></apex:inputField>
                </apex:ActionRegion>
            </td>
            <apex:outputPanel rendered="{!case.Problem__c=='Repair'}" id="ddc">
                <td align="right"><apex:outputText >Requested Day</apex:outputText>
                </td>
                <td align="left"><apex:inputField value="{!case.Requested_Date__c}"/>
                </td>
            </apex:outputPanel>
        </tr>
        <tr>
            <td align="right">
            </td> 
            <td align="right"><apex:commandButton value="Cancel" Model="{!Cancel}"/>
            </td>
            <td align="left"><apex:commandButton value="Create Case" Model="{!save}"/>
            </td>
            <td align="center">
            </td>
        </tr>
    </table>
</apex:form>
</apex:page>

 
Dushyant SonwarDushyant Sonwar
Hi Javeed , 

Problem with your code has been explained by bob buzzard(Keir Bowden). This is due to re-rendering woes.
http://bobbuzzard.blogspot.in/2011/02/visualforce-re-rendering-woes.html

Try with below code , it will work fine . Hope this helps :)
<apex:page standardController="Case" extensions="PublisherController" showHeader="false">
<apex:form >
    <br/><br/><br/><br/>
    <table align="center" width="50%" cellpadding="5">
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Model</apex:outputText>
            </td> 
            <td align="left"><apex:inputField value="{!case.Model__c}"/>
            </td>
            <td align="right" rowspan="2"><apex:outputText >Description</apex:outputText>
            </td>
            <td align="left" rowspan="2"><apex:inputField value="{!case.description}"/>
            </td>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Category</apex:outputText>
            </td> 
            <td align="left"><apex:inputField value="{!case.Category__c}"/>
            </td>
            <td align="right">
            </td>
            <td align="center">
            </td>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Problem</apex:outputText>
            </td> 
            <td align="left">
                <apex:ActionRegion >
                    <apex:inputField value="{!case.Problem__c}"><apex:ActionSupport event="onchange" reRender="ddc"/></apex:inputField>
                </apex:ActionRegion>
            </td>
<apex:outputPanel id="ddc">
            <apex:outputPanel rendered="{!case.Problem__c=='Repair'}" >
                <td align="right"><apex:outputText >Requested Day</apex:outputText>
                </td>
                <td align="left"><apex:inputField value="{!case.Requested_Date__c}"/>
                </td>
            </apex:outputPanel>
</apex:outputPanel>
        </tr>
        <tr>
            <td align="right">
            </td> 
            <td align="right"><apex:commandButton value="Cancel" Model="{!Cancel}"/>
            </td>
            <td align="left"><apex:commandButton value="Create Case" Model="{!save}"/>
            </td>
            <td align="center">
            </td>
        </tr>
    </table>
</apex:form>
</apex:page>

 
Javeed ShaikJaveed Shaik
Hi Dushyanth,

Thanks a lot! I used the above code, the component is Rendering but not in the proper positon.

CasePublisherPage
Dushyant SonwarDushyant Sonwar
Javeed,
Try with below one , previously your table may not be forming properly , now it will work fine.
<apex:page standardController="Case" extensions="PublisherController" showHeader="false">
<apex:form >
    <br/><br/><br/><br/>
    <table align="center" width="50%" cellpadding="5">
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Model</apex:outputText>
            </td> 
            <td align="left"><apex:inputField value="{!case.Model__c}"/>
            </td>
            <td align="right" rowspan="2"><apex:outputText >Description</apex:outputText>
            </td>
            <td align="left" rowspan="2"><apex:inputField value="{!case.description}"/>
            </td>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Category</apex:outputText>
            </td> 
            <td align="left"><apex:inputField value="{!case.Category__c}"/>
            </td>
            <td align="right">
            </td>
            <td align="center">
            </td>
        </tr>
        <tr>
            <td align="right"><apex:outputText >Problem</apex:outputText>
            </td> 
            <td align="left">
                <apex:ActionRegion >
                    <apex:inputField value="{!case.Problem__c}"><apex:ActionSupport event="onchange" reRender="ddc,ddca"/></apex:inputField>
                </apex:ActionRegion>
            </td>
            
                <td align="right">
<apex:outputPanel  id="ddc">
<apex:outputText rendered="{!case.Problem__c=='Repair'}">Requested Day</apex:outputText>
</apex:outputPanel>
                </td>
                <td align="left">
<apex:outputPanel  id="ddca">
<apex:inputField rendered="{!case.Problem__c=='Repair'}" value="{!case.Requested_Date__c}"/>
</apex:outputPanel>
                </td>
            </apex:outputPanel>
        </tr>
        <tr>
            <td align="right">
            </td> 
            <td align="right"><apex:commandButton value="Cancel" Model="{!Cancel}"/>
            </td>
            <td align="left"><apex:commandButton value="Create Case" Model="{!save}"/>
            </td>
            <td align="center">
            </td>
        </tr>
    </table>
</apex:form>
</apex:page>

 
Javeed ShaikJaveed Shaik
Yes Dushyanth!! It will work. I also tried almost the similar approach that you mentined above before your reply.
But I was trying to render the set of fields using a div or outputPanel by calling a single id (id of div or outputPanel) in reRender attribute.

Thanks a lot for your help!!