[英]Why does the onChange event trigger every time I change the year in a date field in chrome?
[英]Set a specific date and year in a MS CRM date time field in the onchange event
我有兩個日期時間字段。 在第一個字段中,如果設置了日期,則在第二個日期時間字段中,日期應自動使用此格式填充。
例如:
開始日期: 1: 09/30/2016
結束日期 2 : 09/29/2017。
以下是我的代碼:
function SetOneplusyearminus1date() {
debugger;
var start = Xrm.Page.getAttribute("msdyn_startdate").getValue();
if (start != null)
{
var endYear = start.setYear(start.getFullYear() + 1);
Xrm.Page.getAttribute("msdyn_enddate").setValue(endYear);
}}
我已經設置了年份但無法設置日期。 所以請幫助我提出您的建議。
嘗試以下代碼:
function SetOneplusyearminus1date() {
debugger;
var start = Xrm.Page.getAttribute("msdyn_startdate").getValue();
if (start != null) {
start.setDate(start.getDate() - 1);
start.setYear(start.getFullYear() + 1);
Xrm.Page.getAttribute("msdyn_enddate").setValue(start);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.