locked
Disable DateInput field in CRM 4.0 RRS feed

  • Question

  • Hi,

    Is there any way to disable date field. Need to disable the DateInput textbox. The image can be disabled. But in the textbox, data can be entered. Can anyone help...

     

    Wednesday, July 7, 2010 7:04 AM

Answers

  • Hi Ritu,

    I checked it from my end It's not comming in gray color, please confirm you have used the same code.

    crmForm.all.DATETIME.Disabled =false;
    var node = crmForm.all["DATETIME" +
    "img"].parentNode.previousSibling.firstChild;
    node.disabled =false;

    crmForm.all["DATETIME" + "img"].src = "/_imgs/btn_dis_cal.gif";
    node.className = "";


    Mahain
    Thursday, July 8, 2010 4:47 AM
    Moderator

All replies

  • Hi ,

    You can do this with the help of java script.

    crmForm .all .<fieldname>_c.style.display = "none"; //hides the label
    crmForm .all .<fieldname>_d.style.display = "none"; //hides the field

    To disable use .Disable at the end.

    hope this will help you.


    • Proposed as answer by Mathan2631 Wednesday, July 7, 2010 7:25 AM
    Wednesday, July 7, 2010 7:22 AM
  • Hi Rittu,

    which script you are using ??? you should not be able to edit this using below code

    crmForm.all.CRMDATETIMEField.Disabled=true;

     


    Mahain
    • Proposed as answer by Mathan2631 Wednesday, July 7, 2010 7:32 AM
    Wednesday, July 7, 2010 7:23 AM
    Moderator
  • I dont want to hide, but need to disable the field

    Wednesday, July 7, 2010 7:35 AM
  • I have used the same script. In the textbox we can type using this.
    Wednesday, July 7, 2010 7:36 AM
  • Ok,

    Just try to use this script it should work

    crmForm.all.DATETIME.Disabled=true;
    var node = crmForm.all["DATETIME" +
    "img"].parentNode.previousSibling.firstChild;
    node.disabled=true;

    crmForm.all["DATETIME" + "img"].src = "/_imgs/btn_dis_cal.gif";
    node.className = "ro"; 

    Let us know


    Mahain

    Wednesday, July 7, 2010 7:49 AM
    Moderator
  • Disabling is working properly. But after disabling, how to enable this without the gray color?
    Wednesday, July 7, 2010 8:42 AM
  • Ok,

    Use below code to enable it

    crmForm.all.DATETIME.Disabled =false;
    var node = crmForm.all["DATETIME" +
    "img"].parentNode.previousSibling.firstChild;
    node.disabled =false;

    crmForm.all["DATETIME" + "img"].src = "/_imgs/btn_dis_cal.gif";
    node.className = "";


    Mahain
    Wednesday, July 7, 2010 8:53 AM
    Moderator
  • Hi Rittu,

    Try using crmForm.all.<DataTimeField>.contentEditable = false;

    Hope this helps

    Regards,

    Vikas Chitale

    Wednesday, July 7, 2010 11:03 AM
  • Hi Mahain,

    After enabling, i can enter in textbox but text is in gray color.

     

    Wednesday, July 7, 2010 1:03 PM
  • crmForm.all.<DataTimeField>.contentEditable = false;

    is not working

    Wednesday, July 7, 2010 1:03 PM
  • Hi,

    This should work.

    // For Disabling

    crmForm.all.Fieldname.Disabled=true;

    // For Enabling

    crmForm.all.fieldname.Disabled=false;

    This works fine for me.

    Else remove the line or comment it for enabling.

     

    • Proposed as answer by Mathan2631 Wednesday, July 7, 2010 1:26 PM
    Wednesday, July 7, 2010 1:26 PM
  • Hi Ritu,

    I checked it from my end It's not comming in gray color, please confirm you have used the same code.

    crmForm.all.DATETIME.Disabled =false;
    var node = crmForm.all["DATETIME" +
    "img"].parentNode.previousSibling.firstChild;
    node.disabled =false;

    crmForm.all["DATETIME" + "img"].src = "/_imgs/btn_dis_cal.gif";
    node.className = "";


    Mahain
    Thursday, July 8, 2010 4:47 AM
    Moderator
  • Hi Mahain,

    The enabling code is also working fine. Thanks ...

    Friday, July 23, 2010 12:41 PM