Axapta Form

Hi Friends

I have a form having overview & general tab. There are two fields say A & B which are present on both tabs.

A is a enum type field. When A=0 i want to enable field B and when A=1 then B is disabled. I can do it by writing codes on modified of control at both places, but I want to write code at one place that will work in all tab.

How to do this?

pls help

Thanks

Hi Manish,

In that case, you can override the ‘modified’ method of field ‘A’ at datasource level in the form. This ‘modified’ method will be called whenever field ‘A’ is modified.

Regards,

Raghavendra.

Hi Raghavendra.,

can u write some code , because what I want that if I select record R then only Field B of record R will be enable/disable.

thanks

Hi Manish,

"I have a form having overview & general tab. There are two fields say A & B which are present on both tabs.

A is a enum type field. When A=0 i want to enable field B and when A=1 then B is disabled. I can do it by writing codes on modified of control at both places, but I want to write code at one place that will work in all tab"

Here is the similar code you can try it,

1> in the form Datasource level you have to override the active method and write similar code as below

public int active()
{
int ret;

ret = super();

if(Table4.FieldA == 0)
{
Table4_ds.object(fieldnum(Table4, FieldB)).enabled(true);
}
else
{
Table4_ds.object(fieldnum(Table4, FieldB)).enabled(false);
}

return ret;
}

2> Same way you have to write in one more place that is Form Datesource level in Fields of FieldB , For FieldB you have to write the Below Code in Override modified method

public void modified()
{
if(Table4.FieldA == 0)
{
Table4_ds.object(fieldnum(Table4, FieldB)).enabled(true);
}
else
{
Table4_ds.object(fieldnum(Table4, FieldB)).enabled(false);
}

super();

}

Hope it will work!