2010-07-09 68 views
0

我想提供有關鉛表單上的屬性的工具提示。我設定了:工具提示在MS CRM中不起作用

crmForm.all.my_custom_attribute_c.title="My required tooltip"; 

但它不工作。爲什麼不應該這樣。所以很多博客都喜歡我這個。我可以在標籤上看到的默認工具提示。請指導

回答

0

我必須寫這個作爲我的問題的答案,因爲別人可能會得到這個問題。我通過下面的代碼解決了這個問題。它工作正常。

// It is a good idea to define the variables at the beginning of each event. 
// This allows you to include conditional statements using the crmForm.FormType property. 

var CRM_FORM_TYPE_CREATE   = 1; 
var CRM_FORM_TYPE_UPDATE   = 2; 
var CRM_FORM_TYPE_READ_ONLY  = 3; 
var CRM_FORM_TYPE_DISABLED   = 4; 
var CRM_FORM_TYPE_QUICK_CREATE = 5; 
var CRM_FORM_TYPE_BULK_EDIT  = 6; 

var oField=crmForm.all.new_projectstatus; 

//Only create the pop-up message if the user can edit or update the form. 
//Do not show the pop-up message in the Quick Create form. 

switch (crmForm.FormType) 
{ 
case CRM_FORM_TYPE_CREATE : 
case CRM_FORM_TYPE_UPDATE : 
case CRM_FORM_TYPE_BULK_EDIT : 

//Create a single popup object on the form that can be re-used by 
// different functions or events in the form. 

     var oPopup = window.createPopup(); 
     var oPopupBody = oPopup.document.body; 
     var width = 250; 
     var height = 0; 
     var strInnerHtml=null; 

     oPopupBody.style.backgroundColor = '#FFFFE8'; 
     oPopupBody.style.fontFamily = 'Arial'; 
     oPopupBody.style.border = '1px solid black'; 
     oPopupBody.style.fontSize='11px'; 
     oPopupBody.style.color='#000000'; 

//Create the function that will be attached to the field mouseover event. 

     function Show_Tooltip() 
     { 

//Get the selected datavalue 
      var selectedFieldValue=oField.DataValue; 

// Set the message HTML as per the selected value. 
      if(selectedFieldValue==1) 
      { 
       strInnerHtml="Have made contact with someone from the company regarding"; 
       strInnerHtml= strInnerHtml+"this scope of work. value or dates may not be available."; 
       height = 50; 
       } 
     else 
      if(selectedFieldValue==2) 
      { 
       strInnerHtml= "FO have put forward a proposal (proactive or reactive)to the";    
       strInnerHtml= strInnerHtml+"client. Waiting on response"; 
       height = 35; 
       } 
     else 
      if(selectedFieldValue==3) 
      { 
       strInnerHtml = "Official expression of interest for a clearly defined scope of work has been"; 
       strInnerHtml= strInnerHtml+"sent to the client"; 
       height = 38; 
      } 
     else 
      if(selectedFieldValue==4) 
      { 
       strInnerHtml = "Post proposal/ EOI Discussions with customer. Dates & Value should be"; 
       strInnerHtml= strInnerHtml+"known & added to the CRM."; 
       height = 48; 
      } 
     else 
      if(selectedFieldValue==5) 
      { 
      strInnerHtml = "Project has been put on hold by the customer. Estimated date of re-"; 
      strInnerHtml= strInnerHtml+"instatement or reminder for follow–up should be put into the"; 
      strInnerHtml= strInnerHtml+"CRM"; 
      height = 50; 
      } 
     else 
      if(selectedFieldValue==6) 
      { 
       strInnerHtml = "FO has been requested to submit an official Quote/Tender for the scope of"; 
       strInnerHtml= strInnerHtml+"work. Please convert this OPPORTUNITY to QUOTE/TENDER"; 
       height = 52; 
       } 

// Set the location and size of the pop-up message. 
// The x and y coordinates are relative to the form element. 

       var x_coord = -80; 
       var y_coord = 20;    

// Associate the pop-up message with the element where the event occurred. 
       var documentElement = event.srcElement; 

// Show the pop-up message. 
       oPopupBody.innerHTML = strInnerHtml; 
       oPopup.show(x_coord, y_coord, width, height, documentElement); 
     } 

// Attach the onmouseover,onkeydown,onkeyup events to the field and the function. 
// It is important that this be done in script after the function is defined. 

crmForm.all.new_projectstatus.attachEvent('onmouseover', Show_Tooltip); 
crmForm.all.new_projectstatus.attachEvent('onkeydown', Show_Tooltip); 
crmForm.all.new_projectstatus.attachEvent('onkeyup', Show_Tooltip); 

} 
+0

對不起,可能會看起來不會格式化。請複製並粘貼到適當的編輯器中。它太有用了。 – 2010-07-27 08:39:33

0

你能從你的頁面發佈實際的代碼嗎?

您需要引用屬性在你的代碼,例如:

crmForm.all.ATTRIBUTE_NAME_c.title="My required tooltip"; 

此外,什麼類型的控制是吧,那你要添加一個工具提示 - 選擇列表,文本等?