Tuesday, February 11, 2014

'modifiedField' on the Table or the Form?

I came across a scenario the other day where my project lead wanted certain things to happen upon a field being modified. He also stipulated that the changes should take place on the Table if at all possible.

In doing a little research I found that if you are modifying a sys form, as I was (SalesTable), then you should avoid making changes like this to the form itself. In this case, I was actually able to use the SalesTableType class and modify the 'modifiedField' method. In this method you will find a switch statement:

Simply add the field you want to have things happen upon 'modifiedField' occuring.

Not all objects have a class like this. In those cases it would be prudent to check the table of the field that you are dealing with. You can use the 'modifiedField' method there to make things happen.