By Ben Tiedt, and a little by Robert McLaws
SubForms can be used to extend existing form controls. Instead of subclassing the existing controls, SubForms let you build your own functionality for Community Server Chameleon controls, without having to worry about recompiling your custom controls with every new CS service pack.
For example, the UserAvatarSubForm can be used with form controls that edit User objects such as the EditUserForm.
A sub-form can modify the edited object (User, for example) before the object is committed as well as after it is committed. A sub-form can have it's own UI, validation, events, etc.
All sub-forms inherit from WrappedSubFormBase and should implement the following members:
Changes applied in the ApplyChangesBeforeCommit() method are made *after* the host form populates the object to be saved but *before* it is committed (so setting properties on the activeObject will be committed by the host form). Changes applied in the ApplyChangesAfterCommit() method are made *after* the host form commits the activeObject - so additional logic or related objects can be manipulated using the activeObject's commited data (in this case, changes must be committed by the sub-form).
To use a sub-form,
See the How to Extend User Registration using Sub-Forms article for an example of implementing a custom Sub-Form control.