• Justin Bernard Rafael Cosio
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hi, I am trying to make a VF page work where there are 6 radio buttons and one save/edit button

Now, how this works is initially, the radio buttons are read only and the value of the save/edit button is "edit", if i click "edit", the radio buttons will be clickable to select one of the six choices and the value of the save/edit button will be "save"

Is there a way to create this logic in professional edition considering that apex classes over there are not available?
So, I already have a VisualForce page up, now, the thing is, i need to add an APEX class extension but unfortunately, for my account, the "Apex Classes" option under the develop menu is disabled. So how do i get this class to be attached to my webpage.


public class CoreValuesEXt
{
    ApexPages.StandardController sc;
    public boolean readonly {get; set;}
    public Core_Values__c cv {get; set;}
    public integer countEdit = 1;
    public string buttonValue {get; set;}
    public integer recordScan;
    public CoreValuesExt(ApexPages.StandardController sc)
    {
        this.sc = sc;
        cv = new Core_Values__c();
        cv.Account__c = sc.getid();
        
        readonly = true;
        buttonValue = 'Edit';
        recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];
       if (recordScan != 0){
       cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];
        }
        
    }
    public ApexPages.PageReference Save()
    {
        return sc.Save();
    }
    
    public void ApplyAction()
    {
        countEdit++;
        Integer modolus = Math.mod(countEdit, 2);
        String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;
        if(modolus == 0)
        {
            readonly = false;
            buttonValue = 'Save';
        }
        else
        {
            if(total != 'nullnullnullnullnullnull')
               {
            if (recordScan == 0){
            insert cv;
            readonly = true;
            buttonValue = 'Edit';
            }
            else
            {
            update cv;
            readonly = true;
            buttonValue = 'Edit';
            }
            }
        }  
        
    }
}
 
I have an issue here. I was able to add all the necessary radio buttons on the VisualForce page for a Core Values  object. When I go to the page, it shows: Content cannot be displayed: Id value 00128000002k7Df is not valid for the Core_Values__c standard controller.

Here's the code.

<apex:page standardController="Core_Values__c">
<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>

      <apex:form >
      <apex:pageBlock >
      <apex:pageblocksection columns="1" title="Core Values">
      <apex:selectRadio label="HSE" value="{!Core_Values__c.HSE__c}" border="1">
      <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 label="Professionalism & Integrity" value="{!Core_Values__c.Professionalism_Integrity__c}" border="1">
      <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 label="Quality / Accuracy" value="{!Core_Values__c.Quality_Accuracy__c}" border="1">
      <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 label="Technology / Innovation" value="{!Core_Values__c.Technology_Innovation__c}" border="1">
      <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 label="Timeliness" value="{!Core_Values__c.Timeliness__c}" border="1">
      <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 label="Value for Money" value="{!Core_Values__c.Value_for_Money__c}" border="1">
      <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:pageblocksection>
      </apex:pageBlock>
      </apex:form>     
</apex:page>
So, I already have a VisualForce page up, now, the thing is, i need to add an APEX class extension but unfortunately, for my account, the "Apex Classes" option under the develop menu is disabled. So how do i get this class to be attached to my webpage.


public class CoreValuesEXt
{
    ApexPages.StandardController sc;
    public boolean readonly {get; set;}
    public Core_Values__c cv {get; set;}
    public integer countEdit = 1;
    public string buttonValue {get; set;}
    public integer recordScan;
    public CoreValuesExt(ApexPages.StandardController sc)
    {
        this.sc = sc;
        cv = new Core_Values__c();
        cv.Account__c = sc.getid();
        
        readonly = true;
        buttonValue = 'Edit';
        recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];
       if (recordScan != 0){
       cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];
        }
        
    }
    public ApexPages.PageReference Save()
    {
        return sc.Save();
    }
    
    public void ApplyAction()
    {
        countEdit++;
        Integer modolus = Math.mod(countEdit, 2);
        String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;
        if(modolus == 0)
        {
            readonly = false;
            buttonValue = 'Save';
        }
        else
        {
            if(total != 'nullnullnullnullnullnull')
               {
            if (recordScan == 0){
            insert cv;
            readonly = true;
            buttonValue = 'Edit';
            }
            else
            {
            update cv;
            readonly = true;
            buttonValue = 'Edit';
            }
            }
        }  
        
    }
}
 
I have an issue here. I was able to add all the necessary radio buttons on the VisualForce page for a Core Values  object. When I go to the page, it shows: Content cannot be displayed: Id value 00128000002k7Df is not valid for the Core_Values__c standard controller.

Here's the code.

<apex:page standardController="Core_Values__c">
<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>

      <apex:form >
      <apex:pageBlock >
      <apex:pageblocksection columns="1" title="Core Values">
      <apex:selectRadio label="HSE" value="{!Core_Values__c.HSE__c}" border="1">
      <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 label="Professionalism & Integrity" value="{!Core_Values__c.Professionalism_Integrity__c}" border="1">
      <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 label="Quality / Accuracy" value="{!Core_Values__c.Quality_Accuracy__c}" border="1">
      <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 label="Technology / Innovation" value="{!Core_Values__c.Technology_Innovation__c}" border="1">
      <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 label="Timeliness" value="{!Core_Values__c.Timeliness__c}" border="1">
      <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 label="Value for Money" value="{!Core_Values__c.Value_for_Money__c}" border="1">
      <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:pageblocksection>
      </apex:pageBlock>
      </apex:form>     
</apex:page>