I just created a new object variable to student__c and tried to insert the record with the values received from VF page i.e. when i clicked on the submit button, it has not shown any error message. But when i checked the tab in the app with my custom object Student__c, there is no records is inserted with the process i have done below. Please help this processed.
apex class:
public class ProcessAdmission {
private ApexPages.StandardController controller;
public String StdFName{get; set;}
public String StdLName{get; set;}
public String StdMName{get; set;}
public String StdFatherName{get; set;}
public String StdMotherName{get; set;}
public Date DOB{get; set;}
public String email{get; set;}
public String Mobilenbr{get; set;}
public String joinClass{get; set;}
public String address {get; set;}
public Integer StudentId {get; set;}
public String gendervalue{get; set;}
public Student__c datarecords{get; set;}
public ProcessAdmission(ApexPages.StandardController cont)
{
this.controller = cont;
datarecords = new Student__c();
}
public void submit()
{
Student__c newRec = new Student__C();
newRec.Address__c = address ;
newRec.Contact_email_Id__c = Mobilenbr;
newRec.Date_of_Birth__c = DOB;
newRec.Father_Name__c = StdFatherName;
newRec.Gender__c = genderValue;
newRec.Join_Class__c = JoinClass;
newRec.Mobile_number__c = mobileNbr;
newRec.Mother_Name__c = StdmotherName;
newRec.Student_First_Name__c = StdFName;
newRec.Student_Last_Name__c = StdLName;
newRec.Student_Middle_Name__c = stdMname;
insert newRec;
}
}
Visualforce Page:
<apex:page standardController="Student__c" extensions="ProcessAdmission">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="New Student Admission">
<apex:outputLabel id="inputtxta" value="First Name" for="StdFName"/>
<apex:inputText id="StdFName" value="{!StdFName}"/>
<apex:outputLabel id="inputtxtab" value="Middle Name" for="StdMName"/>
<apex:inputText id="StdMName" value="{!StdMName}"/>
<apex:outputLabel id="inputtxtb" value="Last Name" for="StdLName"/>
<apex:inputText id="StdLName" value="{!StdLName}"/>
<apex:outputLabel id="inputtxtc" value="Father's Name " for="StdFatherName"/>
<apex:inputText id="StdFatherName" value="{!StdFatherName}"/>
<apex:outputLabel id="inputtxtd" value="Mother's Name " for="StdMotherName"/>
<apex:inputText id="StdMotherName" value="{!StdMotherName}"/>
<apex:outputLabel id="inputtxte" value="Address" for="Stdadress"/>
<apex:inputText id="StdAdress" value="{!address}"/>
<apex:outputLabel id="inputtxtf" value="mobile" for="mobile"/>
<apex:inputText id="mobile" value="{!Mobilenbr}"/>
<apex:outputLabel id="inputtxtg" value="emailId" for="EmailID"/>
<apex:inputText id="EmailId" value="{!email}"/>
<apex:outputLabel id="inputtxth" value="dateofbrith" for="dateofbirth"/>
<apex:inputText id="dateofbirth" value="{!DOB}"/>
<apex:outputLabel id="selectLista" value="Gender" for="StdGender"/>
<apex:selectList id="StdGender" value="{!Gendervalue}" size="1">
<apex:selectOption itemValue="Male" itemLabel="male" />
<apex:selectOption itemValue="Female" itemLabel="female"/>
<apex:selectOption itemValue="Transgender" itemLabel="TansGender"/>
</apex:selectList>
<apex:selectList id="StdClass" value="{!JoinClass}" size="1">
<apex:selectOption itemValue="V" itemLabel="five" />
<apex:selectOption itemValue="VI" itemLabel="six"/>
<apex:selectOption itemValue="VII" itemLabel="seven"/>
<apex:selectOption itemValue="VIII" itemLabel="eigth"/>
<apex:selectOption itemValue="IX" itemLabel="nine"/>
<apex:selectOption itemValue="X" itemLabel="ten"/>
</apex:selectList>
<apex:outputLabel id="buttonid" value="button" for="validate"/>
<apex:commandButton id="validate" value="Submit" action="{!submit}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>