RU beehive logo ITEC dept promo banner
ITEC 325
2015spring
ibarland

homelectsexamshws
D2Lbreeze (snow day)

hw05
Server-side validation

Due: Part (a) 2015.Mar.06 (Fri) 11:00 on D2L only;
The full homework: Mar.16 (11:00), D2L and sources visible on php.radford.edu. (No hardcopy needed.)
For part (a):

We will incrementally improve on hw03—sanitized html: and automated source-listings's TriviaQuack page by adding server-side validation.

As in previous homeworks, your page at https://php.radford.edu/~yourUserId/itec325/hw05/index.php should have a link to your skill-entrytrivia-question form near the top, and include a list all your files (with links), and should also display their source (between Mar.♣17 and Jun.01). Presumably, you will want to copy your hw03 directory to a new hw05 (cp -r ).

Server-side validation

As before, after submitting the trivia-question-form will lead to a page printing the entered information. However, the page's title (and, its heading) should be something like “trivia-question submitted” (as before) or “trivia-question form contained n errors”, as appropriate. Then, if there were errors, give a list of the error-messages, before printing the entered information as before. (In particular, we are not (yet) sending them back to the form, on a failed-submit; that's next hw.)

What to validate

When considering any text input, trim leading/trailing whitespace, and collapse multiple (interior) horizontal-space into a single space-character. (Use the unicode property \p{Z} and preg_replace.) After that, the following properties should hold (and you should report a validation-error-message if they don't).

You might want to start by creating another demo-page which includes some of the wacky things to check for: an entry which is nothing but spaces; an entry claiming the that the difficulty-button “easy-peasey-lemon-squeezy” was selected (even though your form has no such button), etc.. This will help focus your thoughts about what you need to check, when validating.

Structure of code


Other requirements

These apply to all homeworks for this class:

1She probably goes by “Kimmy-Jo M.R.”, but still…      

2 I recommend an array of max-lengths, which map the name-attribute to the length: array( 'skillNameuserAuthorName' => 80, ).      

3Remember that a good CSS style-name describes the meaning (semantics) of the style, not the particular styling it creates: something like “menu-item” or “telephone-number”, or “default-entry”, and not “centered” or “bold-sans-serif” or “blue-italics”. Here is further discussion.      

homelectsexamshws
D2Lbreeze (snow day)


©2015, Ian Barland, Radford University
Last modified 2015.Mar.04 (Wed)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.