2011-06-16 79 views
-1

我有自定義實體,用戶要設置開始日期,我需要一個javacsript代碼,它可以讓我在同一個表單中設置另一個字段的值(結束日期)根據指定的開始日期。 謝謝:)在MS CRM 4.0中使用自定義實體的javaScript

+1

閱讀然後再http://stackoverflow.com/faq發佈您的問題 – Mertis 2011-06-16 13:18:57

回答

0

在你開始數據字段的onChange事件

var startDate = crmForm.all.proposedstart.DataValue; //substitute "proposedstart" by your entity's attribute name 
if (startDate == null) 
    return; 
var endDate = crmForm.all.proposedend.DataValue; //substitute "proposedend" by your entity's attribute name 
if (endDate == null) { 
    endDate = new Date(); 
} 
endDate.setDate(startDate.getDate()+5); // add 5 days to the start date 
crmForm.all.proposedend.DataValue = endDate; 
相關問題