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
Siva@51Siva@51 

Unable to reRender the field vlaues(When Selected 'Yes' it is not making Text_Area__1 & Text_Area__2 required)

<apex:outputpanel id="abc">
    <apex:pageBlockSection rendered="{!ObjectName.Field_Name__c=='xyz'}">
         <apex:inputField required = "true" value="{!ObjectName.Choose__c}">
             <apex:support immediate = "true" event="onchange" reRender="c1,c2"/>
         </apex:inputField>
    <apex:inputField id="c1" value="{!ObjectName.Text_Area1__c}" required="{!ObjectName.Choose=='Yes'}"/>
    <apex:inputField id="c2" value="{!ObjectName.Text_Area2__c}" required="{!ObjectName.Choose=='Yes'}"/>
    </apex:pageBlockSection>
</apex:outputpanel>

 
William TranWilliam Tran
Your code is imcomplete, please post complete code.

What is choose__c? a boolean checkbox?  something else?

Thx
Siva@51Siva@51
Sorry! I don't have it. It is my friend's code. choose_c is picklist field. If we select a value 'Yes', then the two text areas should become required.
William TranWilliam Tran
Well, try this then:

<apex:support...  --> <apex:actionsupport ...

    <apex:pageBlockSection rendered="{!ObjectName.Field_Name__c=='xyz'}">
         <apex:inputField required = "true" value="{!ObjectName.Choose__c}">
             <apex:actionsupport event="onchange" reRender="abc"/>
         </apex:inputField>

<apex:outputpanel id="abc">
    <apex:inputField id="c1" value="{!ObjectName.Text_Area1__c}" required="{!ObjectName.Choose=='Yes'}"/>
    <apex:inputField id="c2" value="{!ObjectName.Text_Area2__c}" required="{!ObjectName.Choose=='Yes'}"/>
</apex:outputpanel>

    </apex:pageBlockSection>