+ Start a Discussion
Benjamin OliverBenjamin Oliver 

Formula Expression is required on the action attributes - No easy fix.

Hello Community,

I am a grad student working with Salesforce for the first time and need some assistance.  I apologize for this obviously played out error, but my situation wasn't able to be remedied quickly.  Therefore I am hoping someone can guide/direct me to a solution.  Below is my VF and Controller code.  Thank you in advance!

VF Page:


<apex:page standardController="Lead" extensions="LeadIntakeController" title="Lead Intake Form" showHeader="false">

<apex:form >

<apex:pageBlock title="Critical Needs Form ">

<apex:pageBlockSection title="Lead" columns="1">

<apex:pageBlockSection columns="2">

<apex:outputText escape="false" value="<b>Lead Details</b>" style="sample"/>

<apex:outputText escape="false" style="sample"/> <apex:inputField value="{!lead.FirstName}"/>

....

</apex:pageBlockSection>

<apex:pageBlockSection columns="2">

<apex:outputText escape="false" value="<b>Dependent Information</b>" style="sample"/>

<apex:outputText escape="false" style="sample"/>

<apex:inputField value="{!dependent.Name}" />

<apex:inputField value="{!dependent.Gender__c}" />

.....

</apex:pageBlockSection>

</apex:pageBlockSection>

<apex:pageBlockButtons >

<apex:commandButton value="Save" action="{!save}" />

</apex:pageBlockButtons>

</apex:pageBlock>

</apex:form>

</apex:page>
 

 

Controller: 

public class Lead_Intake_Controller {

   public Lead lead {get;set;}

   public Lead_Intake_Controller(ApexPages.StandardController controller) 
   {
       lead = (Lead)controller.getRecord();
   }
   
   public PageReference save()
   {

        if(lead!=null)
        {
            Datetime bday = lead.Birthdate__c;
            if(bday.Date().daysBetween(System.now().Date()) > 23709)
            {
                lead.Over_65__c = true;
            }
        
        lead.Recipient__c = true;
        lead.Company = 'Self';

        insert lead;
        
        Dependent__c newDependent = new Dependent__c();
        newDependent.Name = 'value';
        newDependent.Parent_Lead__c = lead.Id;
        newDependent.Contact__c = 'someValue';
        newDependent.Birth_Year__c = 'anotherValue';
        
        insert newDependent;
        }
        
        PageReference pageRef = new PageReference('/apex/Lead_Registration_Complete');
        pageRef.setRedirect(true);
        return pageRef;
   }
   }

 

Best Answer chosen by Benjamin Oliver
William TranWilliam Tran
Change Lead_Intake_Controller  to  LeadIntakeController
So you class should look like this:

 
public class LeadIntakeController {
    public LeadIntakeController(ApexPages.StandardController controller) {
    }
}

As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.

Thanks