For clarity, and as I accepted an answer in the last question, I am posting a new question for additional help with new issues. The last question can be reviewed here.
Here are my new issues:
- When the 'submit' button is pushed on the VF page and the save function from the controller extension is called, the 'congratulations' page shows, as expected, but the record does not actually save.
- I am having difficulty updating my multiple controller extensions that hold logic and need some assistance with how to change the code. Previously, this code worked when using a custom object, Intake__c. However, I need to change to the standard object, Opportunity, and it is not as simple as changing the object name.
I have updated the main extension to:
public class IntakeExtension {
public ApexPages.StandardController ctrl;
public IntakeExtension(ApexPages.StandardController controller) {
this.ctrl = controller;
}
public PageReference save() {
this.ctrl.save();
return Page.Congratulations;
}
}
This does not give me an error - It's only the 'save' here I'm having trouble with.
I have run this 'savetest' with no errors.
static testMethod void saveTest() {
Opportunity o = new Opportunity ();
ApexPages.standardController stdCon = new ApexPages.standardController(o);
ApexPages.currentPage().getParameters().put('Customer_Name__c','Test Name');
IntakeExtension c = new IntakeExtension(stdCon);
c.save();
}
Here is one of my logic extensions I need assistance updating code on:
public with sharing class ShouldShowMedSection{
public ShouldShowMedSection(ApexPages.StandardController paramController) {
Opportunity = paramController;}
public ApexPages.StandardController Opportunity {get; set;}
public Boolean getShouldShowMedSection() {
Opportunity record = (Opportunity)Opportunity.getRecord();
if(
record.Personal_Care_Concerns__c != null && record.Personal_Care_Concerns__c.contains('Medication')
)
{
return true;
}
return false;
}
}
- When I add ShouldShowMedSection to the extensions list on the VF page, I am met with this error: "Error: Unknown property 'ApexPages.StandardController.Customer_Name__c' "
Here is a portion of the VF page code:
<apex:page standardController="Opportunity" extensions="IntakeExtension,ShouldShowSHSection,ShouldShowSHwECSection,ShouldShowPERSSection,ShouldShowMedSection,ShouldShowRingSection" standardStyleSheets="false" showHeader="false" sidebar="false">
<apex:stylesheet value="{!$Resource.styleForIntake}"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<body>
<!-- multistep form -->
<apex:form Id="msform" styleClass="form">
<!-- progressbar -->
<br></br><br></br>
<ul id="progressbar">
<li class="active">Client Info</li>
<li>Residence </li>
<li>Concerns </li>
<li>Tech Comfort</li>
<li>Recommendation</li>
</ul>
<!-- fieldsets -->
<br></br><br></br>
<fieldset>
<br></br><br></br>
<h2 class="fs-title">Client Information</h2>
<h3 class="fs-subtitle">Here, we will gather information specific to the client.</h3> <br></br>
<p>
Client Name (First and Last Initial): <br></br>
<span class="required-text">*required</span>
<br></br>
</p>
<apex:inputField styleClass="fieldset" label="Client Name (First and Last Intial):" value="{!Opportunity.Customer_Name__c}"/>
<br></br> <br></br>
<p>