validate

PHP date validation

PHP date validation FAQ: How do I validate a date in PHP?

This is a little bit of a tough question because you'll probably want more than the basic PHP date validation technique. For instance, to check a person's age you'll probably want to include a limited range of years, and to check something like a credit card expiration date, you'll want to make sure the date is in the future.

That being said, the basic PHP date validation technique is to use the checkdate function, like this:

The CakePHP form save, validate, and debug problem

CakePHP form save/validate/debug FAQ: How do I debug problems in the CakePHP form save/validate process?

One problem I've run into with CakePHP is that while the form validation approach works very well 95% of the time, when it fails it can be very hard to debug. Because the form validation process happens when you invoke the save() method, much of this debugging process seems to be out of your control.

CakePHP require, notEmpty, allowEmpty, and form validation

CakePHP require, notEmpty, and allowEmpty FAQ: Help, I'm trying to edit my CakePHP model $validate field to make sure a CakePHP form field is required, but 'require' doesn't seem to be working as expected.

After fighting with a CakePHP form I just got this information beat into my head, so I thought I'd share it here. In short, if you want to make a CakePHP form field required, what you really want to use is the CakePHP notEmpty rule, like this: