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
udayar_jayamudayar_jayam 

Show/Hide required field based on picklist value issues

Hi All,
I am having two picklist field in VF Page.Based on the 2nd picklist value i need to make the 1st picklist field mandatory, which works fine.,but the issue is once i selected the value in 2nd picklist then the value in 1 st picklist changed, it is not displaying the value I already selected.How can solve this issues. Please let me know what am I doing wrong here

Piklist 1:
<apex:pageBlockSectionItem >  
    <apex:outputlabel value="{!$ObjectType.Case.fields.Is_booking_with_Primary_Freight__c.label}" for="Request"/>   
    <apex:outputPanel id="panel1">  
   <apex:inputField value="{!cases.Is_booking_with_Primary_Freight__c}"  required="{!if(reason == 'Rebook - Bring Booking Forward'||reason == 'Rebook - No Show'||reason == 'Rebook - Transport Company Issue'||reason == 'Rebook - Order was Rejected on initial delivery'||reason == 'Rebook - Vendor Issue'||reason == 'Rebook - BIG W Issue'||reason == 'Consolidate Orders',true,false) }"/>  
   </apex:outputPanel>  
    </apex:pageBlockSectionItem>

Picklist 2:
<apex:pageBlockSectionItem >    
  <apex:outputLabel value="Request Reason" />
  <apex:actionRegion >
  <apex:outputPanel styleClass="requiredInput" layout="block" id="pwPanel" >
   <apex:outputPanel styleClass="requiredBlock"/>
<apex:selectList id="Request_Reason" size="1" value="{!reason}"  label="Request Reason"  required="true" style="width: 155px; " >
     <apex:selectOptions value="{!reasons}" />    
     <apex:actionSupport event="onchange" reRender="panel1"  />    
  </apex:selectList>
</apex:outputPanel>
  </apex:actionRegion>
   </apex:pageBlockSectionItem>
Abhi__SFDCAbhi__SFDC
I tried the similar example but its not resetting any value for me. Could you kindly paste your whole code with class.