+ 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>