locked
How to disable/hide add existing buttons? RRS feed

  • Question

  • Good fay to all.. I create a new entity in members profile.. and i make a 1 to many relationship. But i want to disable the add existing... Because everything must be new/Create new transaction for each entity..

    Hope anyone could help me.....
    Zosimo D. Recio Jr. Microsoft Certified (Business Management Solutions specialist)
    Wednesday, June 24, 2009 5:34 AM

Answers

  • Here is my code.....

    This code is to place the name of the account at the top..

    var CRM_FORM_TYPE_UPDATE     = 2;
    var CRM_FORM_TYPE_UPDATE     = 2;
    var CRM_FORM_TYPE_READ_ONLY  = 3;

    // Only set the title if the form is in update or read-only mode
    if ( (crmForm.FormType == CRM_FORM_TYPE_UPDATE)
          || (crmForm.FormType == CRM_FORM_TYPE_READ_ONLY) ) {
      var cells = document.getElementsByTagName("span");

      // Only continue if the account number has a value
      if (crmForm.all.name.DataValue != null)
      {
      // Loop through the span elements for the ms-crm-Form-Title class style
        for (var i = 0; i < cells.length; i++)
        {
          if (cells[i].className == "ms-crm-Form-Title")
           {
            cells[i].innerText = "Account: " +
              crmForm.all.name.DataValue + " - " + crmForm.all.new_firstname.DataValue +" "+ crmForm.all.new_lastname.DataValue ;
            break;
          }
        }
      }
    }


    And i place it in the lower part of my code.....


    document.getElementById("_MBtoplocAssocOneToMany10004newaccountawards").style.display='none';

    is this the right thing to place??

    Thank you.....


    Zosimo D. Recio Jr. Microsoft Certified (Business Management Solutions specialist)
    Wednesday, June 24, 2009 11:56 PM

All replies

  • By using javascript you can do it.

    -> Get the Id for that button using IE Developer Toolbar
    ->document.getElementById("control id").disabled=true;

    Regards,
    GF
    Wednesday, June 24, 2009 5:39 AM
  • How could i know the "control id" of "Add Exsisting Button"..?
    Zosimo D. Recio Jr. Microsoft Certified (Business Management Solutions specialist)
    Wednesday, June 24, 2009 6:05 AM
  • Download IE Development Tool Bar. It helps to find the full details of controls
    Wednesday, June 24, 2009 6:06 AM
  • hi

    check this post
    Thanks, Aarch
    Wednesday, June 24, 2009 6:22 AM
  • Where should i place this code??? Is it on_Load of the form??
    Zosimo D. Recio Jr. Microsoft Certified (Business Management Solutions specialist)
    Wednesday, June 24, 2009 6:58 AM


  • Correct the above code with the following code
    document.getElementById("control id").style.display='none';

    Wednesday, June 24, 2009 7:12 AM
    • Proposed as answer by Chinmay Patel Wednesday, June 24, 2009 7:31 AM
    Wednesday, June 24, 2009 7:31 AM
  • There was an error...


    "There was an error with this field's Customized event"
    Fields"Window
    Event:Onload
    Error:Object required..


    This was error i encounter after inserting it on the Onload..


    Zosimo D. Recio Jr. Microsoft Certified (Business Management Solutions specialist)
    Wednesday, June 24, 2009 7:57 AM
  • Hi,

    Try this link . In this example u can get element by using name not ID
    Wednesday, June 24, 2009 8:28 AM
  • give me ur javascript code  and for what entities you have created 1:n relationship
    Wednesday, June 24, 2009 8:42 AM
  • Here is my code.....

    This code is to place the name of the account at the top..

    var CRM_FORM_TYPE_UPDATE     = 2;
    var CRM_FORM_TYPE_UPDATE     = 2;
    var CRM_FORM_TYPE_READ_ONLY  = 3;

    // Only set the title if the form is in update or read-only mode
    if ( (crmForm.FormType == CRM_FORM_TYPE_UPDATE)
          || (crmForm.FormType == CRM_FORM_TYPE_READ_ONLY) ) {
      var cells = document.getElementsByTagName("span");

      // Only continue if the account number has a value
      if (crmForm.all.name.DataValue != null)
      {
      // Loop through the span elements for the ms-crm-Form-Title class style
        for (var i = 0; i < cells.length; i++)
        {
          if (cells[i].className == "ms-crm-Form-Title")
           {
            cells[i].innerText = "Account: " +
              crmForm.all.name.DataValue + " - " + crmForm.all.new_firstname.DataValue +" "+ crmForm.all.new_lastname.DataValue ;
            break;
          }
        }
      }
    }


    And i place it in the lower part of my code.....


    document.getElementById("_MBtoplocAssocOneToMany10004newaccountawards").style.display='none';

    is this the right thing to place??

    Thank you.....


    Zosimo D. Recio Jr. Microsoft Certified (Business Management Solutions specialist)
    Wednesday, June 24, 2009 11:56 PM
  • Hi ,

    i suggest you to go through this link which clearly describes how to hide the "add existing " button from the view


    Thanks, Aarch
    Thursday, June 25, 2009 5:07 AM