[SalesForce] I am getting Unknown method ‘Registration__cStandardController.submit()’ error message

I am New To SFDC my task is when user enters the value in input field it should save on my custom object after clicking save button.

But i am getting this error message:

Unknown method Registration__cStandardController.submit()

This is my Code:

<apex:page standardController="Registration__c" showheader="False" sidebar="False">
<apex:messages />
        <apex:form >

    <span style="display:block; margin:50px auto; text-align:Center;color:black;font-size:150%;">REGISTRATION PAGE - ONE TIME</span>
      text-align:center;margin-top: 125px;font-size:150%

        <apex:pageBlock >
        <apex:pageBlockSection >         
        <apex:inputField required="true" value="{!Registration__c.Email_id__c}"/><br /> <br /> 
        <apex:inputField required="false" value="{!Registration__c.Mobile_number__c}"/><br /> <br /> 
        <apex:inputField required="false" value="{!Registration__c.Employee_number__c}"/>  <br /> <br />  

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


Best Answer

Visualforce standard controller does not have any submit button, It has save and cancel, etc buttons. Refer this documentation.

To resolve your issue change:

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


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


With location attribute in apex:pageBlockButtons, placement of the buttons can be controlled.

Possible values include top, bottom, or both. If not specified, this value defaults to both.

Related Topic