Question 83


2.2.3 Question

Multiple Choices

In which of the following scenarios should you include validation? (Choose all that apply.)

  • A. You have an online diary with two form fields, a title, and a large subject box. A title is not required, and the subject content is stored in a database column with no maximum size.
  • B. The web application you maintain has an area that serves as a pass-through to another company’s web services. The form contains personal information, such as address and phone number, and is used to set up a profile on the company’s retirement partner website. The partner has never given you any instructions as to what is or is not required to be sent to them.
  • C. Your application is a long wizard that college students use to apply for financial aid. They do not have access to the application until they are already logged on to the system so the application knows who they are. Most students will log on many times to finish the application, so any field might or might not be completed at any time.
  • D. You are developing a simple form that helps home brewers keep track of their process. The form provides two input fields: Date/time and ph level. The Date/time box needs to be an ordinary text box because people around the world might enter the date differently, in a way that is meaningful to them. The ph level can be either a numeric value or a text description.

Answer:

ABCD
Explanation
A. Correct: You should build in validation to check that at least one field has been populated before saving an entry.
B. Correct: Although the partner company has not provided any requirements, your company is responsible for data entry and therefore should ensure that the data passing through the application meets some minimum criteria.
C. Correct: The application has many entry fields so it is difficult to predict when an entry hits a valid stage. However, you already know you have constraints on the data being input because of the size of the database columns in which you will be storing them. A MaxLength validator on each field would help ensure that there is no loss of data.
D. Correct: Although either field in the form can be anything, they should have a maximum length limit imposed so the data does not exceed the size of the database column they will be stored in. You should also validate that neither field is empty.