Hi everybody,
I'm back with the same problem of a few years ago: complex dialog validation. Now there are a new FieldSaveHandler and a nice validate() method for controls, and a good ValidatingSaveHandler interface for the entire dialog saveHandler. But unfortunately seems it's not enough. I have to validate that some fields/properties have unique values among nodes (siblings/trees), and that there are no more than x children of a given type in certain branches of the data module repo. It seems that almost everything is in place, but unfortunately it isn't (at least for me): the validation part of the saveHandler is triggered before any actual information on the saved node is available in the saveHandler itself. Doing an example with the data module dialog is clearer: the starting class is TypeSelectDataDialog, which is a specialization of the standard DialogMVCHandler. During the save process, the first method called is the ValidatingSaveHandler "validate()", which triggers all custom validation. Then the "onPreSave()" method is called, and in this method, after the validation, the saveHandler is filled with the missing data, the fact that is a creation of a new node or an update, the node name and the node type (which is really important in data module!). But all of this data is needed also in the validate method... The saveHandler has no reference to the calling DialogMVCHandler, which made impossible to call onPreSave. It's either a copy of the method or an extension of TypeSelectDataDialog that stores in the saveHandler a reference to the TypeSelectDataDialog itself, and I don't know which is "better" (I don't particularly like both). On the other hand the storage node is available only during the save method, which is correct from the "save" point of view, but the same data may be really useful even during validation... Now there is no way to have an overlook of what will be saved until the real save, or at least I can't see any, if not doing the save and then completing the validation, but in this case you should delete the node if it was a creation and restore a previous version if it was an update...
Any thoughts about this?

I hope that validation of dialogs in Magnolia 5 would be able to cover more complex cases like these... :-)

Regards, Danilo.


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to