The solution ended up being twofold:
- I had existing rule on the
phone_numberfield that forced the value to be a US phone number. That rule also set
false. I wanted to catch an empty value so I could display a particularly precise message.
- I had to update the existing rule to flip the
requiredvalues and also add a new rule with its
lastvalue set to
The final change, added in my controller action looks like this:
$this->Proposal->Requestor->validate = Set::merge( $this->Proposal->Requestor->validate, array( 'phone_number' => array( 'notempty' => array( 'rule' => 'notEmpty', 'message' => 'Please enter a phone number so can can contact you with any questions about the work.', 'allowEmpty' => false, 'required' => true, 'last' => true, ), 'usphone' => array( 'allowEmpty' => false, 'required' => true, ), ) ) );
I can't remember whether I verified that the change to the existing
usphone rule was strictly necessary given the
last value of the new rule, but this combination is working fine.