WebFund 2015W: Assignment 2

From Soma-notes
Jump to navigation Jump to search

In this assignment you will be modifying the the form-demo code from Tutorial 2.

Please submit your answers as a single zip file called "<username>-comp2406-assign2.zip" (where username is your MyCarletonOne username). This zip file should unpack into a directory of the same name (minus the .zip extension of course). This directory should contain your modified version of form-demo (one version with all code changes).

In addition to the points below, you also get up to 2 points for overall programming style. In total, there are 10 points. The questions below will be automatically graded for everything but style.

Questions

  1. [1] Make the application listen on port 3200 by default.
  2. [1] Add a "Home" link to the submit results screen (/add) that takes you back to the form screen. Note that this should be a link (a tag)!
  3. [2] Add a "Phone" field to the end of the form that behaves similarly to all of the other form entries, in all parts of the application.
    • the name attribute of the phone field should be "phone"
  4. [4] Implement a simple query interface that searches previous records for any record containing partial matches to the query in any of the filled in fields. For example, if the user inputs the string "test" and hits submit, the list screen should have all records which have "test" somewhere in one of its fields. Specifically, this interface should:
    • be a new screen accessible from the main page (/) from a button whose text says "Query"
    • be located at a route named /query
    • contain a form with a single text input whose name attribute is "input" and a single submit button whose action is "/doquery" using a POST request.
    • once submitted, return a listing screen (based on the already existing /list screen) that lists only the records which contain, in one or more of its fields, the input string as a substring.

Solutions

See solution code.