Hello guys,
I have a little problem with my JAvaScript Logic on the quick create form of the incident. I want to make some checkboxes required via JavaScript, when the User chooses a specific value of an lookup field. That works perfectly. But on hitting "save" the required fields are not checked by the system (if not filled) and the record gets saved without a notification.
We have CRM 2015 7.0.1.129 On Premise.
//this is on the onchange event of new_grunddetailid function checkFundingProducts(){ var grunddetail = Xrm.Page.getAttribute("new_grunddetailid"); if(grunddetail != null){ var grunddetailValue = grunddetail.getValue(); if(grunddetailValue != null){ if(grunddetailValue[0].name = "ValueToCheck"){ setOrRemoveRequired(); } } } } //this is also on the onchange event of every checkbox function setOrRemoveRequired(){ var fps = new Array(); fps[0] = Xrm.Page.getAttribute("new_check1"); fps[1] = Xrm.Page.getAttribute("new_check2"); //... some more checkboxes in the same style ... var oneChecked = false; for(var i=0; i<fps.length; i++){ if(fps[i].getText() == "Ja"){ oneChecked = true; break; } } if(oneChecked){ for(var i=0; i<fps.length; i++){ fps[i].setRequiredLevel("none"); } }else{ for(var i=0; i<fps.length; i++){ fps[i].setRequiredLevel("required"); } } }
Hope someone out there can help ;)
Thank you!
Mark_us