How to get the apex inputfield value in the controller?
I am trying to store value in an object using:
in the controller I am doing this:
public Expense_Object__c VS {get;set;}
public PageReference saveAndReturn()
{
        system.debug('Value is:'+VS.Total_Amount__c);
}
I am trying to fetch value here but neither data is getting inserted nor I am getting any value?
To get apex inputfield value in controller-
public Expense_Object__c VS1 {get;set;}//This I was using already
public SaveAndReturnController(ApexPages.StandardController controller)//This
is new
{
 VS = new Expense_Object__c();
 this.controller = controller;
}
public PageReference saveAndReturn()
{
system.debug('X is:'+VS.Vegetable_Amount__c);
PageReference cancel = new
PageReference(ApexPages.currentPage().getHeaders().get('Referer'));
insert VS;//introduced this insert
//controller.save(); I was using this previously so commented
return cancel;
}