I have added 2 custom fields one is checkbox named as 'Click Me' and the other is date named as 'Start Date' to Opportunity Object.And the same is appearing in frontend. Is it possible to disable Start Date when checkbox is unchecked?

Since I don't have vfpage for it how can I achieve this?

Thanks, Gayathri

  • I don't want to create a new vfpage and override the existing standard vfpage
    – Gayathri
    Oct 28 '15 at 9:44

@GayatriYou have 2 options:

Either you can use the validation rule to make the Start Date fields Required as soon as the check box Click ME is checked.

Rule Criteria; AND(Checkbox__c = 0, (NOT(ISNULL(Date Field)))

Or You need to use the Apex code and VF Page:


public class checkBoxEdit{

    public List<Contact> contList {get;set;}
    public List<wrapperClass> wrapList{get;set;}

    public wrapperClass wrap{get;set;}   

    public checkBoxEdit(){
        wrapList = new List<wrapperClass>();
        contList = new List<contact>();
        contList = [Select Id,Name,Email,LastName From Contact];
        for(contact c : contList){
             wrapList.add(new wrapperClass(c));      

    public class wrapperClass{

        public Boolean isEdit{get;set;}
        public Contact cont {get;set;}

        public wrapperClass(Contact con){
            this.cont = con;         

VF Page:

<apex:page controller="checkBoxEdit" >
    <apex:form >
        <apex:pageblock id="pb">
            <apex:pageblockTable value="{!wrapList}" var="w" >
                <apex:column >              
                    <apex:inputCheckbox value="{!w.isEdit}">
                        <apex:actionSupport event="onchange" reRender="pb"/>    
                <apex:column >
                    <apex:outputText value="{!w.cont.email}" rendered="{!w.isEdit == False}"></apex:outputText>
                    <apex:inputText value="{!w.cont.email}" rendered="{!w.isEdit == True}"/>               
  • You can refer to following Link : stackoverflow.com/questions/8578748/…
    – Vipul Goel
    Oct 28 '15 at 9:50
  • I don't want to achieve this through code as its standard one. can I get like onclick of checkbox only the date should appear till then it should not be present
    – Gayathri
    Oct 28 '15 at 10:13
  • This can only be achieveable via Visualforce and apex. Otherwise, you have only Validation rule to make it required
    – Vipul Goel
    Oct 28 '15 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.