0
<apex:column>
    <apex:commandlink value="Reject" action="{!Reject}" reRender="none"/>
    <br/>
    <apex:selectList value="{!selValue}" multiselect="false" size="1" disabled="true" Id="selId"  onchange="enableTxt('{!$Component.selId}','{!$Component.textInput}');"/>
    <p/>
    <apex:inputText id="textInput" value="{!rejReason}" disabled="true" onchange="enableBtn('{!$Component.textInput}','{!$Component.btnid}');"/>
    <apex:commandButton action="{!Save}" value="Send" disabled="true"/>
</apex:column>

I am just giving my part of the code with which I am trying to enable reason for clicking Reject link should display the picklist values of reasons and also a text comment field and send button to send the response.

I tried using reRender, rendered and javascript functions but nothing worked out for me. Please help me how to achieve this solution.

2
  • <apex:commandlink value="Reject" action="{!Reject}" reRender="none"></apex:commandlink> <apex:selectList value="{!selValue}" multiselect="false" size="1" disabled="true" Id="selId" onchange="enableTxt('{!$Component.selId}','{!$Component.textInput}');"> <apex:selectOptions value="{!items}" /> </apex:selectList><p/> <apex:inputText id="textInput" value="{!rejReason}" disabled="true" onchange="enableBtn('{!$Component.textInput}','{!$Component.btnid}');" /> <apex:commandButton action="{!Save}" value="Send" disabled="true" Id="btnid"/></apex:column>
    – Shravan
    Commented Jun 19, 2017 at 20:05
  • i didn't understand the question completely but why did you use the Disabled=true attribute in selectList? Commented Jun 19, 2017 at 20:08

1 Answer 1

0

To enable the disabled elements you need to either remove the disabled attribute and hide the linens in a div that is not rendered initially, then when you call the reject method see a public Boolean property that would be set to true to then display the div, or bind the disabled attribute to that same public Boolean property and rerender the div. That way the platform is doing the heavy lifting. The second solution is closer to your original code posted

<apex:actionRegion>
    <apex:commandlink value="Reject" action="{!Reject}" reRender="none">
    </apex:commandlink>
</apex:actionRegion>
<br/>
<apex:outputPanel id="none" rendered="{!controllerVariableSetToTrueOnLinkCLicked}">
    <apex:selectList value="{!selValue}" multiselect="false" size="1"  Id="selId" onchange="enableTxt('{!$Component.selId}','{!$Component.textInput}');">
    </apex:selectList><p/>
    <apex:inputText id="textInput" value="{!rejReason}"  onchange="enableBtn('{!$Component.textInput}','{!$Component.btnid}');"  />
    <apex:commandButton action="{!Save}" value="Send" >  
    </apex:commandButton>
</apex:outputPanel>

OR

<apex:actionRegion>
    <apex:commandlink value="Reject" action="{!Reject}" reRender="none">
    </apex:commandlink>
</apex:actionRegion>
<br/>
<apex:outputPanel id="none" >
    <apex:selectList value="{!selValue}" multiselect="false" size="1" disabled="{!controllerVariableSetToTrueOnLinkCLicked}"   Id="selId" onchange="enableTxt('{!$Component.selId}','{!$Component.textInput}');">
    </apex:selectList><p/>
    <apex:inputText id="textInput" value="{!rejReason}"  disabled="{!controllerVariableSetToTrueOnLinkCLicked}" onchange="enableBtn('{!$Component.textInput}','{!$Component.btnid}');"  />
    <apex:commandButton action="{!Save}" value="Send" disabled="{!controllerVariableSetToTrueOnLinkCLicked}"  >  
    </apex:commandButton>
</apex:outputPanel>
1
  • To improve your answer, please add at least a short explanation of your code snippets. Thank you! Commented Jun 19, 2017 at 23:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .