+ Start a Discussion
IvarIvar 

Action method not being called

Hi all.

 

I am running into a problem that stumps me, and I was hoping someone was able to give me a hint as to what might be going on.

 

I have a Visualforce page and an Apex Controller for a custom lead capture form I am creating. I don't have any actual business logic in there yet as I am only trying to get a sanity test on the general flow of things. 

 

The problem I am running into is that I have a commandButton that is set to call a method called "createLead" but it just doesn't seem to do that. I have the method down to creating an instance of a very simple custom debug object called Nugget, but nothing is created when I click the button. Does anyone have a clue as to what might be missing?

 

Visualforce page:

 

<apex:page sidebar="false" showHeader="false" controller="VF_LeadCaptureFormController">
  {!Campaign.Name}
  <apex:pageBlock rendered="{!isValid}" id="MainBlock">
     <apex:form>
     <apex:actionFunction name="createLead" action="{!createLead}"/>
     
     Forming<br/>
     <apex:selectCheckboxes value="{!inLead.eq_Forming__c}">
         <apex:selectOptions value="{!formingList}"/>
     </apex:selectCheckboxes>
     
      Freezing<br/>
     <apex:selectCheckboxes value="{!inLead.eq_Freezing_and_Tempering__c}">
         <apex:selectOptions value="{!freezingList}"/>
     </apex:selectCheckboxes>
     <apex:commandButton action="{!createLead}" value="Save" id="SaveButton"/>
 
     </apex:form>
     
  </apex:pageBlock>

 

 

Controller section:

 

public PageReference createLead(){
    
    	Nugget__c n = new Nugget__c();
    	insert n;
    	return null;
}

 Any help would be greatly appreciated.

 

Regards,

Ivar

 

IvarIvar

I figured out it had to do with the way I am using those <apex:selectCheckboxes> fields. As soon as I removed them everything started working again.

 

I'd love to figure out how to use those correctly since I need to incorporate those in my page.

bob_buzzardbob_buzzard

Looking at the docs for this, it may be that the value attribute needs to be an array of Strings rather than an sobject field, which would make sense if there are multiple checkboxes.