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
PawelWozniakPawelWozniak 

Disbale inputtext on specific value from Picklist

I have two fields Picklist System with values SystemA, SystemB, SystemC and additional input text Configuration. 

I expect that if Pciklist System has value SystemB then inputtext Configuration is disabled. In all other cases it is enabled.

 

<apex:variable var="acDisabled" value="FALSE" /> 
<apex:inputField label="System:" id="System" value="{!ptt.ptt_System__c}" required="true" />
<apex:inputtext label="Configuration" id="Configuration" value="{!ptt.Configuration__c}" disabled="{!acDisabled}" /> 

 

I have found that using Visualfoce page variable I can controll that behavior so:

<apex:variable var="acDisabled" value="FALSE" /> 

 means that inputtext is enabled and

<apex:variable var="acDisabled" value="TRUE" /> 

 that it is disabled.

 

Question is how to control that variable? Or is there a better way with JS or JQuery to do that? 

I wouldlike to avoid using controller functionality and page reRender for that simple task.

 

jd123jd123

Hi

 

if it is answer for your question please mark it as resolved. if not please let me know??

<apex:inputField label="System:" id="System" value="{!ptt.ptt_System__c}" required="true" />
<apex:inputtext label="Configuration" id="Configuration" value="{!ptt.Configuration__c}" disabled=true rendered={!ppt.ppt_System__c=='SystemB'/> 
<apex:inputtext label="Configuration" id="Configuration" value="{!ptt.Configuration__c}"  rendered={!ppt.ppt_System__c!='SystemB'/>