The mgiPoll Tag

Tag Behavior

Use the mgiPoll tag to collect and display the results of online surveys.


Tag Syntax

The mgiPoll tag has three modes. Each mode has different required and optional parameters. The modes of mgiPoll are:

  • collect - Collects poll data.
  • admin - Creates a web-based interface to manage polls.
  • tally - Displays poll results.

Collect Mode

The collect mode of mgiPoll has one required parameter and five optional parameters. The tag form is:

<mgiPoll mode="collect" name="Name" username="Name"
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • name - The name is the name of the poll that corresponds with the data being collected.

Optional Parameters:

  • mode - The mode is the function that the mgiPoll tag performs. In "collect" mode, the mgiPoll tag collects poll results and stores them in the poll database. "Collect" is the default mode of the mgiPoll tag.
  • username - The username is the username of the administrator that created the poll. Polls created by different administrators may have the same name and this username parameter differentiates which poll data to collect. The default username is "Admin".
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, poll information will be stored in the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.

Admin Mode

The admin mode of mgiPoll has one required parameter and four optional parameters. The tag form is:

<mgiPoll mode="admin" username="Name" 
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiPoll tag performs. In "admin" mode, the mgiPoll tag creates a web-based interface that allows you to add and manage poll data.

Optional Parameters:

  • username - The username identifies the poll administrator. Administrators will only have access to the polls created with their username. Polls created with different usernames (i.e, by different administrators) may have the same name. The default username is "Admin".
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, poll information will be stored in the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.

Tally Mode

The tally mode of mgiPoll has two required parameter and eight optional parameters. The tag form is:

<mgiPoll mode="tally" name="Name" username="Name" 
color="Color" postArgumentName="Post Argument" 
responseName="Post Argument Value" 
responseNameCellWidth="Whole Number"
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiPoll tag performs. In "tally" mode, the mgiPoll tag calculates the current poll data and displays results in a bar graph.
  • name - The name is the name of the poll to tally.

Optional Parameters:

  • username - The username is the username of the administrator that created the poll. Polls created by different administrators may have the same name and this username parameter differentiates which poll data to tally. The default username is "Admin".
  • postArgumentName - The postArgumentName is the name of the post argument to tally and display. The default behavior is to tally all post arguments in the poll.
  • responseName - The responseName is the value of the post argument to tally and display. The default behavior is to tally and display all values of a post argument. The postArgumentName parameter is required if you include the responseName parameter.
  • responseNameCellWidth - The width of the cell in which the response name is displayed in the tally. The default value is 125.
  • color - The color is the color name or hex code (including pound sign - #) for the bars in the poll graph. If the color parameter is not included, the first color in the poll admin color cycle will be used.
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, poll information will be stored in the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.


Technical Notes

  • Post Argument Name Limit - Post Argument names for poll questions may not exceed 35 characters. The post argument name is not shown to visitors and can be abbreviated to meet the 35 character limit if necessary (e.g., "Q1", "Q2", etc.). The post argument value is not limited and will be displayed to the visitor as a label for poll results.


Example Usage and Output

Collect Mode

<mgiPoll name="President">

In this example, the data from the "President" poll is collected from each poll submission and stored in the poll database.

Admin Mode

<mgiPoll mode="admin">

When you access a page with the mgiPoll tag in admin mode, the functions for creating polls and setting poll preferences are displayed.

Tally Mode

<mgiPoll mode="tally" name="VicePres">

In this example, the results from the "VicePres" poll is tallied and displayed in a bar graph.

<mgiPoll mode="tally" name="VicePres" 
postArgumentName="Republican">

In this example, the results from the "Republican" question of the "VicePres" poll is tallied and displayed in a bar graph.

<mgiPoll mode="tally" name="VicePres" 
postArgumentName="Republican" responseName="Dick Cheney">

In this example, the results for the "Dick Cheney" value of the "Republican" question in the "VicePres" poll is tallied and displayed in a bar graph.


Suggested Usage

  • Polls
  • Surveys


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]