Create a web page with the heading CIS 114 Homework 5 - Arrays
The contents of this page should be a list of links referring to Parts 1-3 discussed below. Label the links, Part1, Part2, Part3. Include a short description for each part on the page of each part.
DO NOT USE ALERT BOXES FOR ERROR MESSAGES!
Create a webpage containing a form that displays an input text box, a group of radio buttons, a group of checkboxes, and select items (a drop-down or datalist element); along with a script that executes form validation.
Your script should validate whether the user has entered data in the input text box, has checked a radio button, has checked at least one checkbox, and has selected an option from the list of options in the select (or datalist) element.
Use a submit button to invoke the validation script, so that the form is processed only when the form fields are ALL valid. If a field is invalid then display a message to the user.
In your form statement, use method="post" and an action that can be a mailto or a webpage (displaying that the form has been processed), but be sure to use input type="submit" for your submit button. Alternatively you can leave out the form's action and method, but then you should use an input type="button", along with displaying any appropriate messages.
Make sure that if you display an error message because of a single field, you do not clear out the whole entire form unless all the fields would have error messages associated to them! It's horrible to have the user fill out all the form again when there was only one field with error, right? Remember about this type of detail that is related to user experience!
Create a 2nd webpage that contains a script that utilizes 2 pulldown menus. The first one should utilize an onchange event handler. The second should utilize a button with an onclick event handler to navigate to a page after an option is selected. Each pulldown menu should include at least 3 URL destinations. The website should open in another tab/window so the user does not need to use the back button of the browser to go back to Part 2 page.
Given the following table of data about several of our states from the July/2019 census, create a webpage that enables the user to enter a state name (full or just the two characters that represent the state) and have the State Name, State Capital, and population appear in separate input box or textarea. DO NOT USE ALERT!!!
The user should be able to start the script by pressing the button, "State Info". Just use the states that are given in the following table for your array. Allow for the user to enter the name or abbreviation of the state in either lower case or upper case letters. If the user enters a state that you do not have information for it, give a message that lets the user know which states you are providing information for - we have 50 states, right? Do not think the user will have the patience to keep guessing which states you can provide information.
Note that solving this problem involves a two-dimensional array. Make sure you validate the input for a correct state abbreviation or state name. If the input is invalid then display an error message. If the user enter a state that is not part of the list, show a message to the user but if the user retypes the state and click the Submit button and the state is valid, then the "error" message should not be shown and, instead, you should show the information that is coming from the table below - for example, suppose the user typed "california" (all in lowercase), you could show a message with something as:
Thanks for your inquiry, here is the information you requested:
State abbr = CA
State Name = California
Capital = Sacramento
Population = 39,512,223
State Abbr | State Name | Capital | Population |
AL | Alabama | Montgomery | 4,903,185 |
AK | Alaska | Juneau | 731,545 |
AZ | Arizona | Phoenix | 7,278,717 |
AR | Arkansas | Little Rock | 3,017,825 |
CA | California | Sacramento | 39,512,223 |
CO | Colorado | Denver | 5,758,736 |
Remember that if the user types an existing state of the United States that you do not have in your table, do not show a message saying "this state does not exist" as it would sound "weird" and not correct - instead you should say that "the database does not have information about this state, we only have information about AL, AK, AZ, AR, CA, and CO"