簡體   English   中英

javascript檢查字段是否具有值

[英]javascript to check if a field has a value

如果沒有價值,那就做一件事,否則做另一件事。 請參閱下面的代碼。 目前無法使用。 我很確定我的if陳述有誤,但不確定如何解決

if(new_steponecontractrecieved)
{
    Xrm.Page.getAttribute("new_totalamountcollected").setValue(item2);
} else
{
    Xrm.Page.getAttribute("new_totalamountcollected").setValue(item1+item2);
}   

請嘗試以下代碼:

var new_steponecontractrecieved= Xrm.Page.getAttribute("new_steponecontractrecieved");
if(new_steponecontractrecieved!=null && new_steponecontractrecieved.getValue()!=null)
{
   //have a value do one thing
}
else if(new_steponecontractrecieved!=null)
{
  //does not have a value do other thing
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM