+ Start a Discussion
kgrasukgrasu 

Why is my visualforce page not saving information from custom fields?

Hi,
I am creating a VF page for creating "New" Log a Call or New Task. I have the following code in VF. The issue is that it is not saving the information for the custom fields when entered, but the data from standard fields like ActivityDate data is saved when the new log a call or task record is inserted.
 
Appreciate all help. Thanks

VF Code:
<apex:page  controller="conTaskNew">
<apex:form >
       <apex:pageBlock id="mypageblock" title="Task Edit" mode="new">  
            <apex:pageBlockButtons >                    
            <apex:commandButton onclick="return lsave()"   action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Task Information" columns="2" id="theSection"> 
            <apex:inputField id="vDisposition" value="{!task.Disposition__c}"/> 
            <apex:inputField id="vActDate" value="{!task.ActivityDate}"/> 
     </apex:pageBlockSection>               
</apex:pageBlock>
</apex:form>
</apex:page>

 
Controller Code:
public class conTaskNew {
   private Task taskobj;
        private String vleadid;
        private String vOwner;
        private String vemail;
        private String vwholead; 
        private String vwhatid;
        private String vdisposition;
        private String vactionbynewten;
        private Date vactivitydate;
        private String vsubject;
        private String vdesc;
        private String vstatus;
        String vid;
       
        
     public   conTaskNew(){  
               this.vleadid = ApexPages.currentPage().getParameters().get('lid');  
               this.vOwner= ApexPages.currentPage().getParameters().get('assignedTo'); 
     }
        
        
       public String getOwner(){
            return this.vOwner;
            }          
        
            
        public void setOwner(String pown){
            this.vOwner = pown;
            }
        
             public Task getTask() {                     
                     return taskobj;
                }
 
                public void setTask(Task taskdet) {
                      taskobj = taskdet;
                }
                                
        
       
        public String getWhoId(){
            return this.vwholead;
            }          
        
            
        public void setWhoId(String pwholead){
            this.vwholead = pwholead;
            }            

        public String getWhatId(){
            return this.vwhatid;
            }          
        
            
        public void setWhatId(String pwhatid){
            this.vwhatid = pwhatid;
            } 
        public String getDisposition(){
            return this.vdisposition;
            }          
        
            
        public void setDisposition(String pdisposition){
            this.vdisposition = pdisposition;
            }             
            

         public Date getActivityDate(){
            return this.vactivitydate;
            }          
        
            
        public void setActivityDate(Date pactivitydate){
            this.vactivitydate = pactivitydate;
            }  
            
       
        public PageReference save() {    
         
              
                
                 Lead leadrec=[Select ownerid from Lead where Id=:this.vleadid];     
                 this.vOwner = leadrec.Ownerid;   
                 Task newtask= new Task(
                 Subject=this.vsubject,  
                 WhoId= this.vleadid,
                 Ownerid= this.vOwner,                 
                 disposition__c= this.vdisposition,                 
                 activityDate= this.vactivitydate              
                 
                 );
                  try{
                      insert newtask;                     
                  }catch(Exception e){
                   throw e;
                  }
                     PageReference secondPage = new PageReference('/'+vleadid);
                     secondPage.setRedirect(true);
                     return secondPage;             
                 
       } 
}

 



Message Edited by kgrasu on 09-05-2008 11:20 AM
hgolovhgolov

Did you ever figure this out? I am having the same issue...

Bhawani SharmaBhawani Sharma
Make sure your IsSave javascript method is not returning false. In case of false, it won't call the controller's save method. Can you please try after removing IsSave ?
Sushma KaranamSushma Karanam
 

 

 

 

What is the difference between save and lsave? My Visualforce page could not save data when I used save but it did when I used lsave.