Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 选择不填充字段值或选项集值时出错_Javascript_Jquery_Dynamics Crm 2011_Dynamics Crm - Fatal编程技术网

Javascript 选择不填充字段值或选项集值时出错

Javascript 选择不填充字段值或选项集值时出错,javascript,jquery,dynamics-crm-2011,dynamics-crm,Javascript,Jquery,Dynamics Crm 2011,Dynamics Crm,伙计们 所以基本上我有两个选项集,从中选择一个值,然后根据这些值计算结果。 我有7个选项集,但没有必要全部使用7个选项集。因此,如果有人只选择使用其中3个选项集中的值,而将其余的保留为空,则用户将得到以下错误 自定义事件字段中出现错误。 活动:onSave 错误:无法获取未定义或空引用的属性“值”。 现在我意识到这个错误意味着其他选项集的值是空的,但是我如何通过这个呢 我使用javascript使用选项集中的值乘以文本字段中的值,然后得到结果。这是我的密码 function cashTotal(

伙计们

所以基本上我有两个选项集,从中选择一个值,然后根据这些值计算结果。 我有7个选项集,但没有必要全部使用7个选项集。因此,如果有人只选择使用其中3个选项集中的值,而将其余的保留为空,则用户将得到以下错误

自定义事件字段中出现错误。 活动:onSave 错误:无法获取未定义或空引用的属性“值”。

现在我意识到这个错误意味着其他选项集的值是空的,但是我如何通过这个呢

我使用javascript使用选项集中的值乘以文本字段中的值,然后得到结果。这是我的密码

function cashTotal()
{


if (Xrm.Page.ui.getFormType() == 1) 
{
var bill1 = Xrm.Page.getAttribute("inmate_cashbills1").getSelectedOption().value;
var bill1Text = Xrm.Page.getAttribute("inmate_cashbill1_text").getValue();

var result1 = bill1 * bill1Text;
 Xrm.Page.getAttribute("inmate_total1").setValue(result1);


var bill2 = Xrm.Page.getAttribute("inmate_cashbills2").getSelectedOption().value;
var bill2Text = Xrm.Page.getAttribute("inmate_cashbill2_text").getValue();

var result2 = bill2 * bill2Text;
 Xrm.Page.getAttribute("inmate_total2").setValue(result2);


 var bill5 = Xrm.Page.getAttribute("inmate_cashbillls5").getSelectedOption().value;
var bill5Text = Xrm.Page.getAttribute("inmate_cashbill5_text").getValue();

var result5 = bill5 * bill5Text;
 Xrm.Page.getAttribute("inmate_total5").setValue(result5);



 var bill10 = Xrm.Page.getAttribute("inmate_cashbills10").getSelectedOption().value;
var bill10Text = Xrm.Page.getAttribute("inmate_cashbill10_text").getValue();

var result10 = bill10 * bill10Text;
 Xrm.Page.getAttribute("inmate_total10").setValue(result10);


  var bill20 = Xrm.Page.getAttribute("inmate_cashbills20").getSelectedOption().value;
var bill20Text = Xrm.Page.getAttribute("inmate_cashbill20_text").getValue();

var result20 = bill20 * bill20Text;
 Xrm.Page.getAttribute("inmate_total20").setValue(result20);





 var tmp = result1 + result2 + result5 + result10 + result20;

 Xrm.Page.getAttribute("inmate_cashtotal").setValue(tmp);

}

我找到了解决办法。而不是
var bill1=Xrm.Page.getAttribute(“囚犯\现金账单1”).getSelectedOption().value

DO


var bill1=Xrm.Page.getAttribute(“囚犯”\u cashbills1”).getValue()

基本上
囚犯现金账单1
是选项集的值
inmate\u cashbill1\u text
是一个值,乘以选项集值即可得出结果。这有什么帮助@Bizzon如果您需要检索可以使用的标签:
var bill1=Xrm.Page.getAttribute(“inmate_cashbills1”).getText()