function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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;

}
}