Chameleon form controls implement the functionality of Community Server forms, such as creating a forum post, editing a user's profile, or registering for a user account.
Form controls in Chameleon define the minimum functionality required to implement the purpose of the form. They provide the glue that makes a set of form element perform an action. When that action is completed, many forms provide the theme developer with a way to define what to do next. For example, the ContactForm blog control defines a form that allows visitors to the site to contact the blog owner:
<CSBlog:ContactForm runat="server" SubjectTextBoxId="Subject" NameTextBoxId="Name" EmailTextBoxId="Email" MessageTextBoxId="Body" SubmitButtonId="Submit">
<SuccessActions>
<CSControl:SetVisibilityAction runat="server" ControlIdsToShow="SuccessMessage" />
</SuccessActions>
<FormTemplate>
<div><CSControl:FormLabel LabelForId="Name" runat="server" ResourceName="Weblog_ContactForm_Name" /></div>
<div><asp:TextBox id="Name" runat="server" /></div>
<div><CSControl:FormLabel LabelForId="Email" runat="server" ResourceName="Weblog_ContactForm_Email" /></div>
<div><asp:TextBox id="Email" runat="server" /></div>
<div><CSControl:FormLabel LabelForId="Subject" runat="server" ResourceName="Weblog_ContactForm_Subject" /></div>
<div><asp:TextBox id="Subject" runat="server" /></div>
<div><CSControl:FormLabel LabelForId="Body" runat="server" ResourceName="Weblog_ContactForm_Body" /></div>
<div><asp:TextBox id="Body" runat="server" TextMode="MultiLine" /></div>
<div>
<asp:Button id="Submit" runat="server" Text="Send" />
<CSControl:ResourceControl runat="Server" id="SuccessMessage" ResourceName="Weblog_ContactForm_Sent" Visible="false" />
</div>
</FormTemplate>
</CSBlog:ContactForm>
The properties of the ContactForm identify the controls within the FormTemplate to use to implement the form's required inputs: Subject, Name, Email, Message, and Submit. The ContactForm itself provides the wiring that makes these form elements perform the task of contacting the blog owner. When the form is successfully processed, the SuccessActions inner-property defines the actions to perform.
Chameleon form controls support the same basic properties as single value base controls (ControlIdsToHideWhenNotVisible, ContainerId, CssClass, Tag, DisplayConditions, LeaderTemplate, TrailerTemplate, DataSource, and Attributes) and also support the following properties (and inherit from WrappedFormBase):
Chameleon form controls function much like themed controls in Community Server 2.1 and earlier. They attach to predefined child-controls and perform an action with them. However, unlike Community Server 2.1 and earlier, Chameleon form controls expose a listing of the supported child controls (via the properties for child control IDs), allow the theme developer to define the control IDs, and allow the theme developer to customize completion actions (via action controls) and form functionality (via sub forms).