I create page using visual force.How to create the custom button/link for the standard page. I need to open the page after click the custom button/link. how to do this. My code is below
<apex:page standardcontroller="Account" tabstyle="Account" extensions="MyExtension" >
<apex:form id="form1">
<apex:commandlink action="{!showForm2}" value="Show the Form" rendered="{!showForm}" reRender="form2,op1"/>
</apex:form>
<apex:outputpanel id="op1">
<apex:form id="form2">
<apex:sectionheader title="Account Details" subtitle="{!if(Account.Id==null,'New Account',Account.Name)}"></apex:sectionheader>
<apex:pageblock mode="edit" id="leadPB" title="Account Edit">
<apex:pageblockbuttons >
<apex:commandbutton action="{!save}" value="Save"></apex:commandbutton>
<!-- If you wish to implement Save & New functionality you will have to write an Apex Extension with your own Save & New Method -->
<apex:commandbutton action="{!cancel}" value="Cancel"></apex:commandbutton>
</apex:pageblockbuttons>
<apex:pageBlockSection >
<apex:inputtext value="{!Account.LastName}" label="Customer Name"/>
<apex:inputtext value="{!Account.PersonMobilePhone}"/>
<apex:inputtext value="{!Account.CustomLandLine__c}"/>
<apex:inputField value="{!Account.City__c}"/>
<apex:inputField value="{!Account.PersonEmail}"/>
<apex:inputField value="{!Account.Source__c}"/>
<!-- <apex:commandButton action="{!save}" value="Save!"/>-->
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageMessages />
</apex:form>
</apex:outputpanel>
</apex:page>`
My class code
public with sharing class MyExtension {
private ApexPages.StandardController sc;
public MyExtension(ApexPages.StandardController sc) {
this.sc = sc;
}
public PageReference save() {
Account a = (Account) sc.getRecord();
a.OwnerId = [select Id from User where LastName = 'Kapoor'].Id;
a.OwnerId = [select Id from User where FirstName = 'Raoul'].Id;
return sc.save();
}
public boolean showForm{get;set;}
// default the var to false;
showForm = false;
public void showForm2(){
showForm = true;
}
}
But it shows the following error
the controller
Error: Compile Error: unexpected token: '=' at line 15 column 9
And in my page,i got this error
Unknown method 'AccountStandardController.showForm2()'
how to solve this