You need to sign in to do that
Don't have an account?

record is not saving
Hi all,
I am clicking on save button record is not inserting...
VF Page:-
------------
<apex:page standardController="Employee1__c" tabStyle="Employee1__c" extensions="Thirdware">
<apex:form >
<apex:pageBlock id="first">
<apex:pageblockSection title="First Page">
<apex:inputfield value="{!Employee1__c.FirstName__c}" />
<apex:inputfield value="{!Employee1__c.LastName__c}" />
</apex:pageblockSection>
<apex:outputPanel id="second">
<apex:outputPanel rendered="{!show}">
<apex:pageBlockSection title="Second page">
<apex:inputfield value="{!Employee1__c.Employee2__c}" />
<apex:inputfield value="{!Employee1__c.Picklist__c}" />
<apex:commandButton value="Approved" />
<apex:commandButton value="Rejected" />
</apex:pageBlockSection>
</apex:outputPanel>
</apex:outputPanel>
<apex:pageBlockButtons location="Bottom">
<apex:actionRegion >
<apex:commandButton value="Save" action="{!savedata}">
<apex:actionSupport reRender="second" event="onchange"/>
</apex:commandButton>
</apex:actionRegion>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex class:-
----------------
public with sharing class Thirdware {
public Boolean show{get;set;}
public string LastName{set;get;}
public string FirstName{set;get;}
public Employee1__c emp {set;get;}
public Thirdware(ApexPages.StandardController controller) {
show = false;
}
public void savedata(){
emp = new Employee1__c();
emp.FirstName__c = FirstName;
emp.LastName__c = LastName;
try{
insert emp;
}catch(Exception e){
}
}
public boolean Save(){
show = true;
return null;
}
}
Regards
Sam
I am clicking on save button record is not inserting...
VF Page:-
------------
<apex:page standardController="Employee1__c" tabStyle="Employee1__c" extensions="Thirdware">
<apex:form >
<apex:pageBlock id="first">
<apex:pageblockSection title="First Page">
<apex:inputfield value="{!Employee1__c.FirstName__c}" />
<apex:inputfield value="{!Employee1__c.LastName__c}" />
</apex:pageblockSection>
<apex:outputPanel id="second">
<apex:outputPanel rendered="{!show}">
<apex:pageBlockSection title="Second page">
<apex:inputfield value="{!Employee1__c.Employee2__c}" />
<apex:inputfield value="{!Employee1__c.Picklist__c}" />
<apex:commandButton value="Approved" />
<apex:commandButton value="Rejected" />
</apex:pageBlockSection>
</apex:outputPanel>
</apex:outputPanel>
<apex:pageBlockButtons location="Bottom">
<apex:actionRegion >
<apex:commandButton value="Save" action="{!savedata}">
<apex:actionSupport reRender="second" event="onchange"/>
</apex:commandButton>
</apex:actionRegion>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex class:-
----------------
public with sharing class Thirdware {
public Boolean show{get;set;}
public string LastName{set;get;}
public string FirstName{set;get;}
public Employee1__c emp {set;get;}
public Thirdware(ApexPages.StandardController controller) {
show = false;
}
public void savedata(){
emp = new Employee1__c();
emp.FirstName__c = FirstName;
emp.LastName__c = LastName;
try{
insert emp;
}catch(Exception e){
}
}
public boolean Save(){
show = true;
return null;
}
}
Regards
Sam
Try with the below Code.
All Answers
Try with the below Code.
It's working but i have a doubt
Why you talken "Input Text" beyond of "InputField".
Thanks
sam
FirstName and LastName are string variable in your controller.
that is the reason I am taking as InputText.
If you do not want to use InputText, you should not use string variables.