You need to sign in to do that
Don't have an account?

Field disabling
Hi All,
I created one component, Field(Request_Managerial_Approval__c) This field is not working properly.
Problem:- when i select field(Peer_Reviewer__c) i need to visible this Field(Request_Managerial_Approval__c) it's working fine.
But when i select field(Peer_Reviewer__c) and click on save(means i am not enter any value of this Field(Request_Managerial_Approval__c),. after reopen the record this Field(Request_Managerial_Approval__c) is disabling.
i need to enable when i reopen or when i enter the value (Peer_Reviewer__c).
<apex:component id="cmpCaseODC" allowDML="true">
<apex:attribute name="thisCon" type="NewCase" required="true" description="controller passed from parent" />
<apex:pageBlockSection title="Contact Information" collapsible="false">
<apex:outputField value="{!thisCon.theCase.OwnerId}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Case Record Type" />
<apex:outputText value="{!thisCon.caseRTName}" />
</apex:pageBlockSectionItem>
<apex:outputField value="{!thisCon.theCase.CaseNumber}"/>
<apex:inputField value="{!thisCon.theCase.ParentId}"/>
<apex:outputField value="{!thisCon.theCase.AccountId}"/>
<apex:outputField value="{!thisCon.theCase.Entitlement__c}"/>
<apex:outputField value="{!thisCon.theCase.ContactId}"/>
<apex:outputField value="{!thisCon.theAsset.Support_Entitlement__r.Contract_Security_Restrictions__c}"/>
<apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Email}"/>
<apex:outputField value="{!thisCon.theCase.Support_Level_formula__c}"/>
<apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Phone}"/>
<apex:inputField value="{!thisCon.theCase.Customer_Reference_Number__c}"/>
<apex:inputField value="{!thisCon.theCase.Internal_Contact_Name__c}"/>
<apex:outputField value="{!thisCon.theCase.Reporting_Office__c}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Internal Department" />
<apex:outputText value="{!thisCon.internalContactDepartment}"/>
</apex:pageBlockSectionItem>
<apex:inputField value="{!thisCon.theCase.Performance_Governance_Case__c}" />
<apex:inputField value="{!thisCon.theCase.Reason_for_Referral__c}" />
<apex:inputField value="{!thisCon.theCase.Sent_Survey__c}" />
<apex:inputField value="{!thisCon.theCase.Approval_Status__c}" />
<apex:inputField id="selReqApproval" value="{!thisCon.theCase.Request_Approval__c}" />
<apex:inputField id="am" onblur="setRequestApproval(this);" value="{!thisCon.theCase.Approving_Manager__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" id="am" />
<apex:outputField value="{!thisCon.theCase.Approving_Manager_Date__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" />
<apex:pageBlockSectionItem >
<apex:outputLabel value="Risk Assessment" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
<apex:actionRegion >
<apex:inputField onblur="setManagerialApprovalRisk(this);" id="selRisk" value="{!thisCon.theCase.Risk_Assessment__c}" rendered="{!thisCon.caseRTName == 'OD Change'}">
<apex:actionSupport event="onchange" rerender="pr,prr" />
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Peer Reviewer" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
<apex:outputPanel id="pr">
<apex:outputPanel rendered="{!if(thisCon.theCase.Risk_Assessment__c != null,true,false)}">
<apex:inputField onblur="return setManagerialApproval(this);" value="{!thisCon.theCase.Peer_Reviewer__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" >
</apex:inputField>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:inputField id="chkManageApprove" value="{!thisCon.theCase.Request_Managerial_Approval__c}" rendered="{!thisCon.caseRTName == 'OD Change'}"/>
<apex:outputField value="{!thisCon.theCase.Peer_Reviewer_Date__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" />
<apex:inputField value="{!thisCon.theCase.SOP_Referenced__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/>
<apex:inputField value="{!thisCon.theCase.SOP_Version__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/>
</apex:pageBlockSection>
<script>
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am') != null){
if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am').value != ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
}else{
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
}
}
function setManagerialApproval(lkp){
if(lkp.value != ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = false;
return false;
}else{
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
return false;
}
return false;
}
function setManagerialApprovalRisk(selList){
if(selList.value == ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
return false;
}
return true;
}
function setRequestApproval(lkp){
if(lkp.value != ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
return false;
}else{
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').checked = false;
return false;
}
return false;
}
</script>
</apex:component>
I created one component, Field(Request_Managerial_Approval__c) This field is not working properly.
Problem:- when i select field(Peer_Reviewer__c) i need to visible this Field(Request_Managerial_Approval__c) it's working fine.
But when i select field(Peer_Reviewer__c) and click on save(means i am not enter any value of this Field(Request_Managerial_Approval__c),. after reopen the record this Field(Request_Managerial_Approval__c) is disabling.
i need to enable when i reopen or when i enter the value (Peer_Reviewer__c).
<apex:component id="cmpCaseODC" allowDML="true">
<apex:attribute name="thisCon" type="NewCase" required="true" description="controller passed from parent" />
<apex:pageBlockSection title="Contact Information" collapsible="false">
<apex:outputField value="{!thisCon.theCase.OwnerId}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Case Record Type" />
<apex:outputText value="{!thisCon.caseRTName}" />
</apex:pageBlockSectionItem>
<apex:outputField value="{!thisCon.theCase.CaseNumber}"/>
<apex:inputField value="{!thisCon.theCase.ParentId}"/>
<apex:outputField value="{!thisCon.theCase.AccountId}"/>
<apex:outputField value="{!thisCon.theCase.Entitlement__c}"/>
<apex:outputField value="{!thisCon.theCase.ContactId}"/>
<apex:outputField value="{!thisCon.theAsset.Support_Entitlement__r.Contract_Security_Restrictions__c}"/>
<apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Email}"/>
<apex:outputField value="{!thisCon.theCase.Support_Level_formula__c}"/>
<apex:outputField rendered="{!NOT(thisCon.isEUCase)}" value="{!thisCon.theCaseContact.Phone}"/>
<apex:inputField value="{!thisCon.theCase.Customer_Reference_Number__c}"/>
<apex:inputField value="{!thisCon.theCase.Internal_Contact_Name__c}"/>
<apex:outputField value="{!thisCon.theCase.Reporting_Office__c}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Internal Department" />
<apex:outputText value="{!thisCon.internalContactDepartment}"/>
</apex:pageBlockSectionItem>
<apex:inputField value="{!thisCon.theCase.Performance_Governance_Case__c}" />
<apex:inputField value="{!thisCon.theCase.Reason_for_Referral__c}" />
<apex:inputField value="{!thisCon.theCase.Sent_Survey__c}" />
<apex:inputField value="{!thisCon.theCase.Approval_Status__c}" />
<apex:inputField id="selReqApproval" value="{!thisCon.theCase.Request_Approval__c}" />
<apex:inputField id="am" onblur="setRequestApproval(this);" value="{!thisCon.theCase.Approving_Manager__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" id="am" />
<apex:outputField value="{!thisCon.theCase.Approving_Manager_Date__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" />
<apex:pageBlockSectionItem >
<apex:outputLabel value="Risk Assessment" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
<apex:actionRegion >
<apex:inputField onblur="setManagerialApprovalRisk(this);" id="selRisk" value="{!thisCon.theCase.Risk_Assessment__c}" rendered="{!thisCon.caseRTName == 'OD Change'}">
<apex:actionSupport event="onchange" rerender="pr,prr" />
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Peer Reviewer" rendered="{!thisCon.caseRTName == 'OD Change'}"></apex:outputLabel>
<apex:outputPanel id="pr">
<apex:outputPanel rendered="{!if(thisCon.theCase.Risk_Assessment__c != null,true,false)}">
<apex:inputField onblur="return setManagerialApproval(this);" value="{!thisCon.theCase.Peer_Reviewer__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" >
</apex:inputField>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:inputField id="chkManageApprove" value="{!thisCon.theCase.Request_Managerial_Approval__c}" rendered="{!thisCon.caseRTName == 'OD Change'}"/>
<apex:outputField value="{!thisCon.theCase.Peer_Reviewer_Date__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" />
<apex:inputField value="{!thisCon.theCase.SOP_Referenced__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/>
<apex:inputField value="{!thisCon.theCase.SOP_Version__c}" rendered="{!thisCon.caseRTName == 'OD Change'}" required="true"/>
</apex:pageBlockSection>
<script>
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am') != null){
if(document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:am').value != ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
}else{
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
}
}
function setManagerialApproval(lkp){
if(lkp.value != ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = false;
return false;
}else{
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
return false;
}
return false;
}
function setManagerialApprovalRisk(selList){
if(selList.value == ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled = true;
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').checked = false;
return false;
}
return true;
}
function setRequestApproval(lkp){
if(lkp.value != ''){
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = false;
return false;
}else{
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').disabled = true;
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:selReqApproval').checked = false;
return false;
}
return false;
}
</script>
</apex:component>
remove that
Also to refer this document to refer component ids. This is a bad practice of naming them
https://www.salesforce.com/us/developer/docs/pages/Content/pages_best_practices_accessing_id.htm
Thanks for given reply.. But first i need disable the field, when i select the Peer_Reviewer__c at that time i need to enable the field.
if i remove this directly it's enabling the field(Request Managerial Approval).
document.getElementById('j_id0:j_id6:j_id432:j_id433:j_id487:j_id491:cmpCaseODC:j_id492:chkManageApprove').disabled= true;
Thanks
kumar
Thanks
kumar
Any other help.
Thanks
sampath
Hi All,
Please help me any other.
Thanks
sam