[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 >
            <html>
  <head>
  <title>RegistrationPage</title>

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

   </style>
   </head>
    </html>
        <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:pageBlockSection>

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

    </apex:pageBlock>
    </apex:form>
</apex:page>

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}"/>

to

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

Added:

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