【发布时间】:2020-08-25 14:14:35
【问题描述】:
我们在表单中的可编辑子网格上使用this snippet,而其中一个属性触发器onchange 事件触发了此功能,并且到目前为止,必要的字段被标记为必填项。因此用户无法保存可编辑的子网格行,并且自动保存也会被一条通知消息阻止。
它现在突然停止工作,调试时没有错误或异常,尽管该字段被 onchange 函数标记为必填 - 用户仍然可以在必填字段中保存没有值的记录。不知道为什么现在观察到这种行为变化。
还有其他人遇到过这个问题吗?有什么解决方法吗?
function ReasonChange(eContext) {
debugger;
// get the attribute which fired the onchange.
var reasonAttr = eContext.getEventSource();
// get the container for the attribute.
var attrParent = reasonAttr.getParent();
// get the value of the reason.
var reason = reasonAttr.getValue();
if (reason != null) {
// var field1 Attribute
var field1 = attrParent.attributes.get("new_followupdate");
//Callback
if (reason[0].id == "{33E9E459-5A8B-EA11-A812-000D3A5A17E3}") {
// set field as mandatory.
field1.setRequiredLevel("required");
}
else {
//clear field value
field1.setValue(null);
// set field as mandatory.
field1.setRequiredLevel("none");
}
}
【问题讨论】: