The mgiPoll Tag

Tag Behavior

The mgiPoll tag tallies and displays the results of user-defined survey questions.


Tag Syntax

The mgiPoll tag has three required parameters and six optional parameters. The tag form is:

<mgiPoll databaseFileLocation="File Path"
tableName="Table Name" formatFileLocation="File Path" 
tally="Yes/No" tallyResultsBy="Total/PercentageOfTotal" 
colorCycle="Color List" maximumBarGraphLength="Pixels" 
barGraphHeight="Pixels" retainedIPEntries="Integer">

Required Parameters:

  • databaseFileLocation="File Path" where "File Path" is the relative path to an existing database file or the name of a new database file. If the database file does not exist, it will be created. The database name is case-sensitive.
  • tableName="Table Name" where "Table Name" is the name of an existing database table or the name of a new database table in the database file specified by the databaseFileLocation parameter. The table name is case-sensitive.
  • formatFileLocation="File Path" where "File Path" is the relative path to the file that specifies the format of the poll questions and answers. Notes: 1) The answers to poll questions can only be formatted as radio buttons, checkboxes or popup menus. 2) When results are tallied and displayed, each answer and the results for that answer will be displayed according to the answer's location in the format file.

Optional Parameters:

  • tally="Yes/No" where "Yes" indicates that the poll results are tallied and displayed and "No" indicates that the poll results are not displayed. The default value is "No". When the tally option is set to "Yes", poll questions are not displayed from the format file and answers are not submitted to the poll database. If you wish to display the poll results in addition to collecting poll data, enter the tally parameter in a separate mgiPoll tag.
  • tallyResultsBy="Total/PercentageOfTotal" where "Total" indicates that poll results for each answer will be displayed as whole numbers and where "PercentageOfTotal" indicates that poll results will be displayed as a percentage of the total responses to each question. The default value is "Total".
  • colorCycle="Color List" where "Color List" is the comma delimited list of colors that are cycled for each poll answer when the results are tallied. The available colors are: blue, green, orange, red, violet and yellow (The default color cycle is also in that order). To customize the color Cycle, enter the full name of each color and separate each color with a comma and no space (e.g., "blue,red").
  • maximumBarGraphLength="Pixels" where "Pixels" is the maximum length of each bar graph for poll results in pixels. The default value is 500 pixels.
  • barGraphHeight="Pixels" where "Pixels" is the height of each bar graph for poll results in pixels. The default is 15 pixels.
  • retainedIPEntries="Integer" where "Integer" is the number of IP entries to save in a database and compare to the IP number of a current poll submission. The IP number of each unique poll submission is added to the database. If a visitor's IP number matches an existing IP number in the database, the visitor's poll submission will not be added to the poll database (although the submission process will continue uninterrupted from the visitor's perspective). When all IP entries are full, the IP number of the next unique poll submission replaces the oldest IP number in the database. The retainedIPEntries parameter is designed to keep single visitors from voting multiple times in the same poll.


Example Usage and Output

<mgiPoll databasefilelocation="Surveys"
tableName="Election2000"
formatFileLocation="pollformat.txt">

The mgiPoll tag in this example would display the question, answers and submit button in the pollformat.txt file.

<mgiPoll databasefilelocation="Surveys"
tableName="Election2000"
formatFileLocation="pollformat.txt">

The mgiPoll tag in this example would submit responses to the Election2000 table in the Surveys database file. This tag would go on the page that is the action of the form contained in the poll format file.

<mgiPoll databasefilelocation="Surveys"
tableName="Election2000"
formatFileLocation="pollformat.txt"
tally="yes"
tallyresultsby="total"
maximumbargraphlength="300"
bargraphheight="13"
colorcycle="blue,red">

The mgiPoll tag in this example would tally and display the results from the questions and answers in the Election2000 table of the Surveys database file. Each result would be graphed according to the answer's location in the pollformat.txt file. Each bar graph would not exceed 300 pixels in length and would be 13 pixels high. Beginning with the first result, the color of each bar graph would alternate between blue and red.


Suggested Usage

  • Polls and Surveys


[Return to the Referencing MGI Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]