You need to sign in to do that
Don't have an account?
Athira Venugopal
Unable to create a custom button with content as a visual force page , visual force page is not shown in the content
Here is my visual force page and apex controller:
StudentDisplay.vfp
<apex:page Controller="StudentDetails" >
<apex:form >
<apex:pageBlock title="New Student">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!stud.Name}"/>
<apex:inputField value="{!stud.Class__c}"/>
<apex:inputField value="{!stud.DOB__c}"/>
<apex:inputField value="{!stud.Physics__c}"/>
<apex:inputField value="{!stud.Chemistry__c}"/>
<apex:inputField value="{!stud.Maths__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!addNewStudent}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
StudentDetails .apxc
public class StudentDetails {
public StudentData__c stud { get; set; }
// Here initialize the book object
public StudentDetails() {
stud = new StudentData__c();
}
public PageReference addNewStudent() {
insert stud;
return null;
}
}
StudentDisplay.vfp
<apex:page Controller="StudentDetails" >
<apex:form >
<apex:pageBlock title="New Student">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!stud.Name}"/>
<apex:inputField value="{!stud.Class__c}"/>
<apex:inputField value="{!stud.DOB__c}"/>
<apex:inputField value="{!stud.Physics__c}"/>
<apex:inputField value="{!stud.Chemistry__c}"/>
<apex:inputField value="{!stud.Maths__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!addNewStudent}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
StudentDetails .apxc
public class StudentDetails {
public StudentData__c stud { get; set; }
// Here initialize the book object
public StudentDetails() {
stud = new StudentData__c();
}
public PageReference addNewStudent() {
insert stud;
return null;
}
}
See this post for reference
Let me know if it helps
Thanks,
Anudeep