0

Ok, so this code initially has radio buttons set to disable. I have a second button which calls the javascript function. Somehow it doesn't work. Ive tried Jquery and it still wont enable. Is there any way to format this?

<script type = "text/javascript">

  function toEdit(){

  document.getElementById("{!$Component.cvpg:cvfrm:cvpgblk:cvpgsc:qa}").disabled = false;
  document.getElementById("{!$Component.cvpg:cvfrm:cvpgblk:cvpgsc:hse}").disabled = false;
  document.getElementById("{!$Component.cvpg:cvfrm:cvpgblk:cvpgsc:tml}").disabled = false;
  document.getElementById("{!$Component.cvpg:cvfrm:cvpgblk:cvpgsc:prf}").disabled = false;
  document.getElementById("{!$Component.cvpg:cvfrm:cvpgblk:cvpgsc:vfm}").disabled = false;
  document.getElementById("{!$Component.cvpg:cvfrm:cvpgblk:cvpgsc:ti}").disabled = false;
  }


</script>

<style type="text/css">
input[type="radio"]:checked {
    background-image: url("http://throwingthebowlines.com/wp-content/uploads/2013/12/checkbox.png");
}
        input[type="radio"]:checked+label{ color:red; font-weight:bold; } 
    </style>
    <!--<script type="text/javascript"  src="/js/functions.js">
        var __sfdcSessionId = '{!GETSESSIONID()}';
    </script>
    <script src="/soap/ajax/28.0/connection.js" type="text/javascript"></script>
    <script src="/soap/ajax/28.0/apex.js" type="text/javascript"></script>-->



<apex:form id="cvfrm" >
<apex:pageBlock id="cvpgblk">
<apex:pageblocksection columns="1" title="Core Values" id="cvpgsc">

<apex:selectRadio id="qa" label="Quality & Accuracy" value="{!Account.Quality_Accuracy__c}"  border="1" disabled="true">
<apex:selectOption itemLabel="Excellent" itemValue="6"/> 
<apex:selectOption itemLabel="Very Good" itemValue="5"/>
<apex:selectOption itemLabel="Good" itemValue="4"/>
<apex:selectOption itemLabel="Average" itemValue="3"/>
<apex:selectOption itemLabel="Fair" itemValue="2"/>
<apex:selectOption itemLabel="Poor" itemValue="1"/>
</apex:selectRadio>

<apex:selectRadio id="hse" label="HSE" value="{!Account.HSE__c}"   border="1" disabled="true">
<apex:selectOption itemLabel="Excellent" itemValue="6"/>
<apex:selectOption itemLabel="Very Good" itemValue="5"/>
<apex:selectOption itemLabel="Good" itemValue="4"/>
<apex:selectOption itemLabel="Average" itemValue="3"/>
<apex:selectOption itemLabel="Fair" itemValue="2"/>
<apex:selectOption itemLabel="Poor" itemValue="1"/>
</apex:selectRadio>

<apex:selectRadio id="tml" label="Timeliness" value="{!Account.Timeliness__c}"   border="1" disabled="true">
<apex:selectOption itemLabel="Excellent" itemValue="6"/>
<apex:selectOption itemLabel="Very Good" itemValue="5"/>
<apex:selectOption itemLabel="Good" itemValue="4"/>
<apex:selectOption itemLabel="Average" itemValue="3"/>
<apex:selectOption itemLabel="Fair" itemValue="2"/>
<apex:selectOption itemLabel="Poor" itemValue="1"/>
</apex:selectRadio>

<apex:selectRadio id="prf" label="Professionalism & Integrity" value="{!Account.Professionalism_Integrity__c}"   border="1" disabled="true">
<apex:selectOption itemLabel="Excellent" itemValue="6"/>
<apex:selectOption itemLabel="Very Good" itemValue="5"/>
<apex:selectOption itemLabel="Good" itemValue="4"/>
<apex:selectOption itemLabel="Average" itemValue="3"/>
<apex:selectOption itemLabel="Fair" itemValue="2"/>
<apex:selectOption itemLabel="Poor" itemValue="1"/>
</apex:selectRadio>

<apex:selectRadio id="vfm" label="Value for money" value="{!Account.Value_for_money__c}"  border="1" disabled="true">
<apex:selectOption itemLabel="Excellent" itemValue="6"/>
<apex:selectOption itemLabel="Very Good" itemValue="5"/>
<apex:selectOption itemLabel="Good" itemValue="4"/>
<apex:selectOption itemLabel="Average" itemValue="3"/>
<apex:selectOption itemLabel="Fair" itemValue="2"/>
<apex:selectOption itemLabel="Poor" itemValue="1"/>
</apex:selectRadio>

<apex:selectRadio id="ti" label="Technology & Innovation" value="{!Account.Technology_Innovation__c}"  border="1" disabled="true">
<apex:selectOption itemLabel="Excellent" itemValue="6"/>
<apex:selectOption itemLabel="Very Good" itemValue="5"/>
<apex:selectOption itemLabel="Good" itemValue="4"/>
<apex:selectOption itemLabel="Average" itemValue="3"/>
<apex:selectOption itemLabel="Fair" itemValue="2"/>
<apex:selectOption itemLabel="Poor" itemValue="1"/>
</apex:selectRadio>

<apex:commandButton id="btn" action="{!quickSave}" value="Save"/>
<apex:commandButton id="btn2" onclick="toEdit()" value="Edit"/>

</apex:pageblocksection>
</apex:pageBlock> 
</apex:form> 
</apex:page>
  • 1
    Justin, I have edited you post for you so that all of you code is now visible. In the future, please ensure all of your code is visible before posting. If it's not, press the edit link at bottom left, select any problematic code and then press the pre-formatted text button to fix the problem. – crmprogdev Mar 19 '15 at 3:18
  • Do you have to use javascript? If not, you should try apex:actionFunction. – lw29 Mar 19 '15 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.