validate

Play Framework: How to write multiple custom validation functions for a form field alvin April 11, 2018 - 2:22pm

If you ever need to include multiple Play Framework 2.6 validators for a template form field, the uri field below shows the syntax that worked for me:

PHP date validation alvin April 8, 2011 - 1:30pm

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 alvin January 12, 2011 - 1:20pm

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: