none
Disable fields

    Question

  • Hi all,

     

    I was trying to assign a default value to the owner field and then to disable it

    so i have tried the following code to disable the field

    crmForm.all.ownerid.Disabled=true;

     

    but after doing the field has been disabled but the owner name is still accessible which means that the user data still accessible

     

    the question is:

    how to completly disable the field so that no body can click on the user name to access the data

     

    any help will be appreciated,

     

    thanks in advance :)

    Wednesday, October 06, 2010 11:51 AM

Answers

  • function DisableLookupLinks(lookupFieldName) {
     var lookupParentNode = document.getElementById(lookupFieldName + "_d");
     var lookupSpanNodes = lookupParentNode.getElementsByTagName("SPAN");
    
     for (var spanIndex = 0; spanIndex < lookupSpanNodes.length; spanIndex ++) {
      var currentSpan = lookupSpanNodes[spanIndex];
      
      currentSpan.onclick = function() {};
     }
    }
    

    To disable a field's Lookup links, pass the field's schema name into the function.  For example, for the "Customer" field on a Case:

    DisableLookupLinks("customerid");
    


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Wednesday, October 06, 2010 6:36 PM
    Moderator

All replies

  • I don't want it to be inaccessible

    I want it to be a read only field

     

    thanks for your efforts

    Wednesday, October 06, 2010 12:15 PM
  • i don't which part of my scenario is weird ??!!!

     

    i want the owner field to be a read only field !!!!!

    Wednesday, October 06, 2010 12:20 PM
  • This weired part could break the security as i think that users data must not be accessible for anybody
    Wednesday, October 06, 2010 12:36 PM
  • It doesn't need any explanation if you click on the field contents it will open the user form and you'll be able to its data
    Wednesday, October 06, 2010 12:43 PM
  • Ok. I see. I wish you luck, Mostafa. I will never disturb you on this forum.

    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, October 06, 2010 12:58 PM
    Moderator
  • function DisableLookupLinks(lookupFieldName) {
     var lookupParentNode = document.getElementById(lookupFieldName + "_d");
     var lookupSpanNodes = lookupParentNode.getElementsByTagName("SPAN");
    
     for (var spanIndex = 0; spanIndex < lookupSpanNodes.length; spanIndex ++) {
      var currentSpan = lookupSpanNodes[spanIndex];
      
      currentSpan.onclick = function() {};
     }
    }
    

    To disable a field's Lookup links, pass the field's schema name into the function.  For example, for the "Customer" field on a Case:

    DisableLookupLinks("customerid");
    


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Wednesday, October 06, 2010 6:36 PM
    Moderator
  • Thanks alot David, you're the best
    Thursday, October 07, 2010 8:57 AM