Is it possible to disable input in one field if another is filled?

♀尐吖头ヾ 提交于 2021-02-17 05:08:30

问题


I want to disable input into fields of a table, if another field contains data in MS Dynamics AX 2012.

UPDATE 1:

If Field1 has input, Field2 and Field3 MUST be EMPTY

|Field1|Field2|Field3| Customer nr | Id|

|---1---|--------|--------| 0000000001| 01

UPDATE 2:

Can the system fire an error/warning message, like it does when entering a duplicate value in an ID --> AllowDuplicates: No

-

Cannot create a record in Table (Table). Table Id: 01. The record already exists.


回答1:


Yes, make a method on the table.

In this case (on ProjTable) the editing of the name on sub projects is prohibited:

void setFieldProperty()
{
    FormObjectSet fds = this.dataSource();
    if (fds)
    {                
        fds.object(fieldNum(ProjTable,Name)).allowEdit(!this.ParentId);
    }
}

Then call the method from the form datasource active method and from datasource fields modified methods on which the critieria depends (in this case ParentId).

Response to UPDATE 2:

Take a look on aosValidateInsert and aosValidateUpdate



来源:https://stackoverflow.com/questions/10976083/is-it-possible-to-disable-input-in-one-field-if-another-is-filled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!