Hi all,
I have a scenario where I have to disable a field if the second field value is yes.
I have two fields created in InventTabble table i.e.
- String type (Manufactur ID)
- Enum type (MID per batch)
The default value for "MID per batch" is No.
I have to show this fields in the "EcoResProductDetailsEntended" form based on a condition i.e.
- if "MID per batch" = Yes then disable "Manufactur ID) and,
- if "InventItemSetupSupplyType.DefaultOrderType <> "Purchase Order" then disable "MID per batch" and "Manufactur ID" fields.
I am using the modified( ) method under the form method and code used is -
public void modified( )
{
if(InventTable.MIDPerBatch == NoYes::Yes)
{
InventTable_ds.object(fieldnum(InventTable, ManufacturID)).allowEdit(false);
}
else
{
InventTable_ds.object(fieldnum(InventTable, ManufacturID)).allowEdit(true);
}
if(InventItemSetupSupplyType.DefaultOrderType <> "Purchase Order")
{
InventTable_ds.object(fieldnum(InventTable, MIDPerBatch)).allowEdit(false);
InventTable_ds.object(fieldnum(InventTable, ManufacturId)).allowEdit(false);
}
else
{
InventTable_ds.object(fieldnum(InventTable, MIDPerBatch)).allowEdit(true);
InventTable_ds.object(fieldnum(InventTable, ManufacturId)).allowEdit(true);
}
}
But I am still not able to perform the requirement - am I doing wrong or should I not be using the modified( ) method or am I calling the method under wrong form level. I tried to create the method under the data source of InventTable method but still no result.
How can I disable the fields based on the other field conditions?