You need to sign in to do that
Don't have an account?
Naofumi Kun
Disable a field depending on a Picklist value in Apex
Hi I need your help here.
We need to have schedule.Start_Date__c disabled when schedule.Products_Offer__c == 'Product B'.
Also, I would like to know if it is possible that it will be disabled as soon as I select the Picklist Product B.
We need to have schedule.Start_Date__c disabled when schedule.Products_Offer__c == 'Product B'.
Also, I would like to know if it is possible that it will be disabled as soon as I select the Picklist Product B.
<apex:actionRegion> <div class="slds-truncate" title=""> <apex:inputField style="width:90px;" value="{!schedule.Start_Date__c}" rendered="{!schedule.Products_Offer__c != 'Willow Rail Platform'}"> <apex:actionSupport event="onchange" rerender="tableId" status="status"/> </apex:inputField> <apex:outputField style="width:90px;" value="{!schedule.Start_Date__c}" rendered="{!schedule.Products_Offer__c == 'Willow Rail Platform'}"> <apex:actionSupport event="onchange" rerender="tableId" status="status"/> </apex:outputField> </div> </apex:actionRegion>Any kind of help is much appreciated!
try to add outputpanel:
<apex:outputPanel rendered="{!if(!schedule.Products_Offer__c= 'Product B',true,false)}">
<apex:inputField style="width:90px;" value="{!schedule.Start_Date__c}" rendered="{!schedule.Products_Offer__c != 'Willow Rail Platform'}">
</apex:outputPanel>
Hope it Helps you.
If it is helpful information.Please mark as Best Answer
Thanks
Sumitha P
I got the following error when I try to use your code.
<apex:outputPanel rendered="{!if(!schedule.Products_Offer__c== 'Product B',true,false)}">
Include '==' in the above line.
Thanks
Sumitha P
I think the system is not accepting
Because the true and false value are actual text
<apex:outputPanel rendered="{!if(schedule.Products_Offer__c== 'Product B',true,false)}">
Try this i have Excluded ""!".
and working on my end.
Thanks
Sumitha
The results are the just disappear regardless of the current of the Picklist
Thanks