Now, before proceeding further, I need to decide how this class is going to work. Here's how I plan to use it: As you can see, I would like to call class methods with two parameters: the name of the form variable to validate, and the error message to return in the event the validation test fails. With this in mind, it becomes much easier to design the class appropriately. Once the basic functionality of the class is clear, it's a good idea to spend some time listing the important methods, together with their purpose. Here's my initial cut: isEmpty($var, $errormsg) - check whether the specified form variable is empty; isString($var, $errormsg) - check whether the specified form variable contains string data; isNumber($var, $errormsg) - check whether the specified form variable contains numeric data; isWithinRange($var, $errormsg) - check whether the specified form variable contains a value within the specified numeric range; isEmailAddress($var, $errormsg) - check whether the specified form variable contains a valid email address; isError() - check whether any errors have occurred in form validation; getErrorList() - return the list of validation errors; resetErrorList() - reset the error list. These are the essential methods; there may be more, which I will add as development progresses.
blog comments powered by Disqus |