locked
CRM 4.0 Disabling datefield with javascript RRS feed

  • Question

  •  

    Hi,

     

    I want to disable some datefields on the onload event depending on the values in some other fields.So i have to disable the datefields with javascript instead of the normal field disable function.

     

    i am using the following code:

      crmForm.all.cit_lastupdate1img.disabled = true;
      crmForm.all.cit_lastupdate1img.src = '/_imgs/btn_dis_cal.gif';

     

    This works fine and disables the datepicker image. But i am missing 2 things here.

     

    1) It is still possible to put in a date by tying it manually. How do i prevent this?

    2) How do i change the background and bordercoler of the field?(Not the image). I have tryied the following but it doesnt work.
      style.borderColor = "#c5c5c5";
      style.backgroundColor = "#eaf3ff";

     

     

    regards

    Ben

    Thursday, March 27, 2008 9:30 AM

Answers

All replies

  • Hi,

     try the following line of code for issue #1

     crmForm.all.Control Name.Disabled=true;

     

    thanks

     

     

     

    Thursday, March 27, 2008 9:59 AM
  • try this

     

    crmForm.all.field_name.disable='true';

     

    for more www.stunnware.com/crm2/

     

    Regards,

    Imran

     

    http://microsoftcrm3.blogspot.com

     

     

    Monday, April 7, 2008 1:25 PM
    Moderator
  • Benjamin,

     

    Chris2383 and Imran are right on how to disable the field.  You only need to put:

     

    crmForm.all.cit_lastupdate.Disabled = true;

     

    Be sure the Disabled is capitalized as JavaScript is case sensitive. 

     

    Also, if you want to change the color of the background of the field, here's the code you need:

     

    crmForm.all.cit_lastupdate.style.fontWeight= 'bold';

    crmForm.all.cit_lastupdate.style.fontStyle = 'italic';

    crmForm.all.cit_lastupdate.style.backgroundColor = 'yellow';

     

    That should do it for you.

     

    Good luck.

     

    Fronk

    Monday, April 7, 2008 2:45 PM
  • hi,

      you can also try this

        crmForm.all.ControlName_c.style.backgroundColor="red";

        crmForm.all.ControlName_d.style.backgroundColor="red";

        crmForm.all.ControlNameimg.backgroundColor="red";

     

    All the best.
    Tuesday, April 8, 2008 7:35 AM