admin管理员组文章数量:1414902
I want to be able to loop through all the fields on a form and make them required in a bit of javascript. I have been able to do a similar thing to make them disabled and have retrieved them all with var controls = Xrm.Page.ui.controls.get();
, but I know to set requirement level I need to get the attribute rather than the UI control, how can get get all attributes at once so I can loop through them?
Thanks
I want to be able to loop through all the fields on a form and make them required in a bit of javascript. I have been able to do a similar thing to make them disabled and have retrieved them all with var controls = Xrm.Page.ui.controls.get();
, but I know to set requirement level I need to get the attribute rather than the UI control, how can get get all attributes at once so I can loop through them?
Thanks
Share Improve this question asked Nov 28, 2012 at 11:49 jimminybobjimminybob 1,4422 gold badges28 silver badges62 bronze badges1 Answer
Reset to default 5Copied almost exactly from the CRM SDK:
function MakeAllAttributesRequired() {
var attributes = Xrm.Page.data.entity.attributes.get();
for (var i in attributes) {
attributes[i].setRequiredLevel("required");
}
}
本文标签: dynamics crm 2011javascriptMake all fields on a form requiredStack Overflow
版权声明:本文标题:dynamics crm 2011 - javascript - Make all fields on a form required - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745158436a2645316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论