0

I have below piece of code where click on Coach button needs to disable input field Outcome. I have placed that in below code which is not giving desired output. Can someone please let me know?

Apex Page:

            <apex:tabPanel rerender="pms">
                <apex:tab label="HCP Detail Calls" >
                    <apex:pageblockTable id="HCPDetail" value="{!oIncTranListHCPDetail}" var="itr" >
                     <apex:column headervalue="Coach">
                       <apex:actionRegion >                                    
                                <apex:actionStatus id="SaveStatus_HCP_Detail">
                                    <apex:facet name="start"  >                                            
                                        <apex:outputText value="Saving...!" />
                                    </apex:facet>
                                    <apex:facet name="stop"  >
                                        <apex:image url="/img/msg_icons/confirm16.png" title="Saved Successfully" rendered="{!itr.Id == targetId}" />
                                    </apex:facet>
                                </apex:actionstatus>
                    <apex:inputField id="out" value="{!itr.Confirm_Attestation_abv__c}" onchange="jsCoachSave('{!itr.Id}','{!itr.Confirm_Attestation_abv__c}');" />
                 <!--   <script>document.getElementById('{!$Component.out}').disabled = {!itr.Confirm_Attestation_abv__c}; </script> -->
                    <apex:inputField label="Transaction Type" value="{!itr.Recordtype.name}" style="display:none;"/>

                            <apex:commandButton id="chk" value="Coach" onclick="jsCoachSave('{!itr.Id}','{!itr.Confirm_Attestation_abv__c}');" action="{!reset}" rerender="none"/>
                          </apex:actionRegion>
                    </apex:column>
                        <apex:column headerValue="Incident ID ">
                            <apex:outputLink value="/{!itr.Id}">{!itr.Name}</apex:outputLink>
                        </apex:column>
                        <apex:column value="{!itr.Account_abv__c}"/>
                        <!--  <apex:column value="{!itr.Call_abv__c}"/>              -->
                        <apex:column value="{!itr.Product_abv__c}"/>
                        <apex:column value="{!itr.Time_of_Event_ABS_abv__c}"/>
                        <apex:column value="{!itr.Audit_Reason_abv__c}"/>
                        <apex:column headerValue="Transaction Type" value="{!itr.Recordtype.name}"/>
                        <apex:column headerValue="Outcome" >
                            <apex:actionRegion >
                                <apex:actionStatus id="SaveStatus">
                                    <apex:facet name="start"  >                                            
                                        <apex:outputText value="Saving...!" />
                                    </apex:facet>
                                    <apex:facet name="stop"  >
                                        <apex:image url="/img/msg_icons/confirm16.png" title="Saved Successfully" rendered="{!itr.Id == targetId}" />
                                    </apex:facet>
                                </apex:actionstatus>
                                <apex:inputField id="chk1" value="{!itr.Outcome_abv__c}" onchange="jsCallSave('{!itr.Id}','{!itr.Recordtype.name}');"  rendered="{!itr.Confirm_Attestation_abv__c == false}">
                                </apex:inputField>
                                <script>document.getElementById('{!$Component.chk1}').disabled = {!itr.Confirm_Attestation_abv__c}; </script>
                                <apex:inputField label="Transaction Type" value="{!itr.Recordtype.name}" style="display:none;"/>
                            </apex:actionRegion>
                            <apex:outputField value="{!itr.Outcome_abv__c}" rendered="{!itr.Confirm_Attestation_abv__c == true}"/>
                        </apex:column>


                    </apex:pageblockTable>
                </apex:tab>
            </apex:tabPanel>

Please find jsCoachSave function here.

function jsCoachSave(citId,Attest){
            document.getElementById('pg:fm:iTargetId').value = citId;
            document.getElementById('pg:fm:iAttest').value = Attest;                
            CoachSave(citId,Attest);  //

        }

It calls apex function CoachSave as below.

1 Answer 1

1

Please use below code when your are clicking on Button as well jsCoachSave javascript method also not present in your code.

$('[id$=apexInputFieldId]').attr("disabled","true");
6
  • Can you please let me know where to place this exactly? This approach would suffice for me I guess. Thanks in advance! Commented Jul 8, 2015 at 14:59
  • onclick of button will be enough if you don't have much functionality depend when clicked on button. else you can keep in a method and call that method from onclick of button. Commented Jul 8, 2015 at 15:01
  • Can you please do the page level change here? I am not getting it exactly. Sorry for that. :( Commented Jul 8, 2015 at 15:02
  • ok. what this does "jsCoachSave". can i remove this? Commented Jul 8, 2015 at 15:04
  • Please find jsCoachSave editted in the question. This is required to do necessary DML in a method. Commented Jul 8, 2015 at 15:05

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.