DISC 3371 Chad-less Final Exam Answers -- Parks -- Fall 2000

Visitors note: The XML works in IE5 and above

For President:
   I choose not to vote in this race
   Washington
   Jefferson
   Madison
For Senator:
   I choose not to vote in this race
   Lewis
   Clark
   Sitting Bull
For Govenor:
   I choose not to vote in this race
   Wilson
   Spadling
   Luther
Voter Registration Code

The single HTML page shown above is a four row - two column table. This on-line ballot allows a user to cast votes in three election races (president, senate, govenor). In addition to choosing a candidate in each race, a radio button labelled "I choose not to vote in this race" always appears as the first choice. When the page is loaded, all three of the "I choose not to vote in this race" radio buttons are checked. Shown above is the page status after the user has clicked on "Clark".

There are two gif files: v1.gif and v2.gif used to visually reinforce the user actions. The gif files appear in the first column of the first three rows. The v1.gif file shows that no vote has been cast in the row (shown in rows 1 and 3 above). The v2.gif file shows that the a vote has been cast in that row (shown in row 2 above). When the page is loaded, all three images in the first column are the v1.gif. The user will make choices in each of the three races (or not). If they choose a radio button OTHER than "I choose not to vote in this race", the v2.gif should appear in the first column of that row (i.e., they vote for a candidate). If they at any time click on the "I choose not to vote in this race" radio button, the v1.gif image appears in the first column. The sub which performs the image swap is named simage.

When the user clicks the submit button, a sub named sendvote is executed which builds an XML string and sends it to the server (www.uvotem.com). This string of XML is stored as a hidden variable named xs. Construct the XML string to store: the voter registration code and the votes cast in each of the three races. Use the name that appears on the ballot as the content value for the tag in each of the three races. (e.g., use "Washington" as the content if they clicked the Washington radio button). If the "I choose not to vote in this race" has been checked, use the value "NOVOTE" as the tag content. You design the tag names.

The sub sendvote also validates the ten digit voter registration code. First, the code must be exactly ten characters. Secondly, of the ten characters that make up a valid voter registration code, exactly 5 characters are the digits zero through 9. Third, when these five digits are extracted from the code and added together the sum always adds up to the value 20. The five digits may occur anywhere in the voter registration code. If the code is not valid, a message is displayed to the user that their code is invalid and they must try again. If the code is invalid, the XML is NOT sent to the server.

The HTML page contains two forms. The first form is named f1 and contains all the radio buttons and the voter registration code (named vrc). The second form named f2 contains only the hidden XML string xs.

Part 1 (5 points) Show the HTML for the page
Part 2 (25 points) Show the VBScript code for the sub named simage
Part 3 (70 points) Show the VBScript code for the sub named sendvote