I have this code that is used to determine if a field on a row is enabled based on the value of another field on the same row. If the value if the first field changes, that can change the enabled status of the second field.
protected void _(Events.FieldSelecting<MyDAC, MyDAC.secondField> e, PXFieldSelecting baseMethod )
{
if (baseMethod != null )
{
baseMethod(e.Cache, e.Args);
}
MyDAC row = e.Row;
if (row != null)
{
if (row.firstField == true)
{
PXUIFieldAttribute.SetEnabled<MyDAC.secondField>(e.Cache, row, false);
}
}
}
However, the PXUIFieldAttribute
line of code shows an error PX1070: The state of fields and actions can be configured only in the RowSelected event handler.
This code will compile and it works. So my question is, is the logic used to trigger the PX1070 incorrect? Or is there a more correct way to achieve this goal? Or do I just ignore PX1070 in this case?
Best answer by Dmitrii Naumov
View original