Creating form functions

Moving on

In the steps shown above we created a single function – if you create aditional classes like DemoFunctionFactory and DemoFunction and register them with an aditional <add /> element in Composite.configuration you can build a small library of Form Functions.

Form Functions are also great for providing options for items like select boxes. If your function returns a structure like Dictionary<Guid, string> you can use it in a setup like this:

<KeySelector Label="Category" Help="Category" OptionsKeyField="Key" OptionsLabelField="Value" xmlns:cms="">
    <cms:bind source="Id" />
    <CategoryOptions xmlns="">
        <cms:read source="PageIdForeignKey" />

This markup invokes the default selector which gets its options from a function registered as "CategoryOptions" living in the namespace The function is passed data from the forms bindings collection.