You need to sign in to do that
Don't have an account?
priya123
Want to display the default value in the standard picklist
I am displaying the task related fields and values in the visualforcepage.In this page, i just try to display the field as {!task.WhatId} in tag.But in the VF page, it is displaying the first value as default. I want to display the default value as Campaign.and also I am using the custom controller.Can anyone help?Very Urgent..
Hi,
You can achieve this by using the JavaScript on your page
For reference use the below code:
------------ VF page---------------
<apex:page controller="createtask" id="page1" >
<apex:form id="frm1" >
<apex:inputField value="{!task1.whatid}" id="taskwhatid"/>
</apex:form>
<script>
document.getElementById("page1:frm1:taskwhatid_mlktp").value='701';
</script>
</apex:page>
---- Apex Controller ----------------
public class createtask
{
public task task1{get;set;}
public createtask ()
{
task1=new task();
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi,
You can achieve this by using the JavaScript on your page
For reference use the below code:
------------ VF page---------------
<apex:page controller="createtask" id="page1" >
<apex:form id="frm1" >
<apex:inputField value="{!task1.whatid}" id="taskwhatid"/>
</apex:form>
<script>
document.getElementById("page1:frm1:taskwhatid_mlktp").value='701';
</script>
</apex:page>
---- Apex Controller ----------------
public class createtask
{
public task task1{get;set;}
public createtask ()
{
task1=new task();
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.