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
DrBixDrBix 

Disabling Fields based on a select box value

So I was trying to disable some fields based on a select box value, and it worked.  However, when the select box value changed again, the field did not become re-enabled.  Is the reason the fields are not being re-enabled because they are disabled, and, if so, is there a better way to do this?

 

Thanks in advance.

 

<!--

  This select box controls the shipment method.

-->

<apex:selectList value="{!shipment.Shipment_Mode__c}" size="1">
   <apex:selectOptions value="{!ShipmentModes}"/>
   <apex:actionSupport event="onchange" rerender="perishableSelected" status="searchStatus"/>
</apex:selectList>

 

<!--

  This field depends on the value of the select box.

-->

<apex:pageBlockSectionItem helptext="{!$ObjectType.Shipment__c.Fields.Perishable__c.inlineHelpText}">
<apex:outputLabel value="{!$ObjectType.Shipment__c.Fields.Perishable__c.label}"/>
<apex:inputCheckbox id="perishableSelected" value="{!shipment.Perishable__c}" disabled="{!shipment.Shipment_Mode__c='PerishableTransport'}" />
</apex:pageBlockSectionItem>