none
Picklist联动,现在每次打开纪录都是联动的第一条记录,在onload事件中写了以下代码,出现了什么问题? RRS feed

  • 问题

  • var CRM_FORM_TYPE_CREATE = 1;
    var CRM_FORM_TYPE_UPDATE = 2;
    var CRM_FORM_TYPE_QUICKCREATE = 5;
    
    
    // Only enable the dynamic picklist on a Create or Update form.  Disabled and 
    // read-only forms are not editable and so do not require dynamic picklists.
    switch (crmForm.FormType)
    {
    	case CRM_FORM_TYPE_CREATE:
    	case CRM_FORM_TYPE_UPDATE:
            case CRM_FORM_TYPE_QUICKCREATE:
    
    
    		var oresoucedetail = crmForm.all.nc_ownershipcodedetail;
    
    		oresoucedetail.originalPicklistOptions = oresoucedetail.Options;
    
    		if (crmForm.all.nc_ownershipcode.DataValue == null)
    		{
    			oresoucedetail.Disabled = true;
    		}
    		else
    		{
    			var oresouce = crmForm.all.nc_ownershipcode;
    			
    			var iStartIndex = -1;
    			var iEndIndex = -1;
    			
    			switch (oresouce.SelectedText)
    			{
    				case "A级":
    					iStartIndex = 1;
    					iEndIndex = 8;
    					break;
    			
    				case "B级":
    					iStartIndex = 9;
    					iEndIndex = 12;
    					break;
    				case "C级":
    					iStartIndex = 13;
    					iEndIndex = 16;
    					break;
    				
    			}
    			
    
    			var oresoucedetail = crmForm.all.nc_ownershipcodedetail;
    			
    			if (iStartIndex > -1 && iEndIndex > -1)
    			{
    				// Create a new array, which will hold the new picklist options
    				var oTempArray = new Array();
    			
    				// Initialize the index for the temp array
    				var iIndex = 0;
    			
    				// Now loop through the original resoucedetail options, pull out the
    				// requested options a copy them into the temporary array.
    				for (var i = iStartIndex; i <= iEndIndex; i++)
    				{
    					oTempArray[iIndex] = oresoucedetail.originalPicklistOptions[i];
    					iIndex++;
    				}
    			
    
    				oresoucedetail.Options = oTempArray;
    			
    				oresoucedetail.Disabled = false;
    			}
    			else
    			{
    				oresoucedetail.DataValue = null;
    				oresoucedetail.Disabled = true;
    			}
    			
    			
    		}
    
    	break;
    }
    2010年4月1日 13:00

全部回复

  • 你要实现什么功能?现在出现什么错误信息?


    Batistuta Cai-刀客 | 蔡敏生 | MS CRM MVP | Blog:http://caims.cnblogs.com
    2010年4月8日 6:27
    版主