0

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>
2
  • Error says that you have no action method submit defined in your code. Looks like you are using standard controller, you may want to use a custom controller and define the necessary action
    – Raul
    Mar 28, 2017 at 9:10
  • If you need to call the standard Save method, replace the {!submit} action by {!Save} Mar 28, 2017 at 9:11

1 Answer 1

0

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.

2
  • Hi Rahul , Thanks for your help its working now but am getting two save buttons now how to remove one save button
    – Anjaan
    Mar 28, 2017 at 9:15
  • With two button you might be getting one at top and one at bottom. Updated the answer, please check.
    – Raul
    Mar 28, 2017 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.