Little Things can make a Difference
Just a tiny update, but it can change the way we work with complicated forms --
Sometimes the save semantics required for an AutoForm are more complicated than just persisting the target object to the database. One approach that has been taken in the past is to sublcass AutoForm and override the AutoForm::save() method. This is not without its problems, however, as the AutoForm::save() method has a number of steps internally (pre-processing, delete handling, saving, post-processing and the on-complete callback).
To provide another option for dealing with these complex form submission scenarios I have added a new callback hook called AutoForm::customSaveHandler. If set, this callback is called instead of the default DataItem::save() method. You can perform any processing you like in the callback, and return true for success and false for failure. The callback is passed a reference to the AutoForm, so you have full access to the target DataItem and other fields, and can write error message back via the AutoForm::$msg field. Stop subclassing and start extending today!
XML upgrades for managing site configuration changes » « Simplified DataItems and Calculated Fields
