Using Form Server Controls to Display Forms

Form server controls provides flexibility with the appearance of a form.

Displaying a poll with the poll server control

Displaying a Poll with the Poll Server Control

The Poll server control displays a poll or survey created from an Ektron form on a Web page. When added to a template and visited, the poll might look like this. You can change a poll‘s appearance by modifying its properties.

You should display a poll or survey with a Poll server control, because it provides great flexibility with the poll’s appearance. Typically, developers want a poll or survey in a small section of a Web page, not the main content. By using the EnableAjax property, you can display the results in the same area as the poll or survey without refreshing the entire page.

However, if you want the form/poll/survey’s response to be either Redirect to a file or page or Redirect form data to an action page, you must use a Form Block server control to display the form on a Web page. See Also: Displaying a Form with the FormBlock Server Control

Poll server control properties

The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.

  • {Poll ID} (Long)

    The ID of the poll that appears where you inserted this server control. If you don’t know the ID number of the pol, use the CMS Explorer to browse to it. See Also: Browsing Your Ektron Site Using CMS Explorer

  • AddValidation (Boolean)

    The AddValidation property is obsolete and ignored. It has no effect. It is always true.

  • Authenticated (String)

    Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.

  • CacheInterval (Double)

    The number of seconds that the server control’s data is cached. The default is 0 (zero). For example, if you want to cache the data for 5 minutes, set to 300. See Also: Caching with Server Controls.

  • DoInitFill (Boolean)

    By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.

  • DynamicParameter (String)

    To make this form block dynamic, select ekfrm. When you do, this server control uses the form block passed as a URL parameter.

  • EnableAjax (Boolean)

    Can displays the poll or results using an iFrame in the area of the page that contains the poll. As a result, the surrounding contents are not disturbed . The default is true.

    • True—Polls and results are shown in an iFrame without modifying or refreshing the surrounding contents.
    • False—Poll and the results replace the Web page’s content.
  • Fields (FormFieldCollection)

    Displays a list of fields that are defined in the form. These fields are read only. This is an excellent way of displaying the field names used on the form. With this list of names, you can create events using the fields without having to enter the Workarea to see the names.

  • Hide (Boolean)

    Hides or displays the output of the control in design time and run time.

    • True—Hide the control output.
    • False—Display the control output.
  • Include Tags (Boolean)

    Determines if tags are generated automatically of manually. See Also: Automatic versus Manual Generation of Form Tags

  • Language (Integer)

    Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).

  • SuppressWrapperTags (Boolean)

    Suppresses the output of the span/div tags around the control.

    • True—Suppress wrap tags.
    • False (default)—Allow wrap tags.
  • WrapTag (String)

    Lets a developer specify a server control’s tag.

    • Span (default)—designate an inline portion of an HTML document as a span element.
    • Div—apply attributes to a block of code.
    • Custom—Lets you use a custom tag.
Automatic versus manual generation of form tags

Automatic versus Manual Generation of Form Tags

When using the poll server control’s IncludeTags property, you have 2 options.

Option

Recommended if you are developing

How to Enable

Let Ektron generate form tags automatically

A pure script .aspx page

Set IncludeTags property to True.

Modify HTML form tags in the .aspx file

An .aspx page and associated code-behind Web form

Set IncludeTags property to False.

Here is the default .NET generated form tag:

<form id="Form1" method="post" runat="server">

Modify the form tag as indicated in red:

<form id="Form1" method="post" runat="server" OnSubmit=”return EkFmValidate(this);”>

Editing the poll results bar chart

Editing the Poll Results Bar Chart

To edit the style and appearance of the bar chart, modify the following files:

  • siteroot/workarea/csslib/reportchart.css
  • siteroot/workarea/controls/forms/HistogramReportPoll.xslt

Those files include extensive comments that explain how to customize the bar chart's appearance.

NOTE: Pie charts are not editable.

Displaying a form with the FormBlock server control

Displaying a Form with the FormBlock Server Control

The FormBlock server control displays a content block associated with a form. When added to a template and visited, the form content block might look like the following example. You can change the display to suit your needs by modifying its properties.

 

WARNING! If you create a template for an existing form content block, you must manually change its quicklink to point to the new template. This change does not occur automatically. This procedure is described in Adding a Quicklink or Form to Content.

FormBlock server control properties

The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.

  • AddValidation (Boolean)

    The AddValidation property is obsolete and ignored. It has no effect. It is always true.

  • Authenticated (String)

    Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.

  • CacheInterval (Double)

    The number of seconds that the server control’s data is cached. The default is 0 (zero). For example, if you want to cache the data for 5 minutes, set to 300. See Also: Caching with Server Controls.

  • DefaultFormID (Long)

    The ID of a FormBlock that appears where you inserted this server control if no other form block is identified. If you don’t know the ID number of the form block, use the CMS Explorer to browse to it. See Also: Browsing Your Ektron Site Using CMS Explorer.

  • DoInitFill (Boolean)

    By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.

  • DynamicParameter (String)

    To make this form block dynamic, select id. When you do, this server control uses the form block passed as a URL parameter.

  • Fields (FormFieldCollection)

    Displays a list of fields that are defined in the form. These fields are read only. This is an excellent way of displaying the field names used on the form. With this list of names, you can create events using the fields without having to enter the Workarea to see the names.

  • Hide (Boolean)

    Hides or displays the output of the control in design time and run time.

    • True—Hide the control output.
    • False—Display the control output.
  • IncludeTags (Boolean)

    Determines if tags are generated automatically of manually. See Also: Automatic versus Manual Generation of Form Tags

  • Language (Integer)

    Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).

  • SuppressWrapperTags (Boolean)

    Suppresses the output of the span/div tags around the control.

    • True—Suppress wrap tags.
    • False (default)—Allow wrap tags.
  • WrapTag (String)

    Lets a developer specify a server control’s tag.

    • Span (default)—designate an inline portion of an HTML document as a span element.
    • Div—apply attributes to a block of code.
    • Custom—Lets you use a custom tag.
Automatic versus manual generation of form tags

Automatic versus Manual Generation of Form Tags

When using the FormBlock Server control’s IncludeTags property, you have 2 options.

Option

Recommended if you are developing

How to Enable

Let Ektron generate form tags automatically

A pure script .aspx page

Set IncludeTags property to True.

Modify HTML form tags in .aspx file

An .aspx page and associated code-behind Web form

Set IncludeTags property to False.

Here is the default .NET generated form tag:

<form id="Form1" method="post" runat="server">

Modify the form tag as indicated in red:

<form id="Form1" method="post" runat="server" OnSubmit=”return EkFmValidate(this);”>