I'm facing a problem with the validation message upon the notBlank rule. (I use notBlank as notEmpty has been deprecated).
I tried to change the default validation message with notBlank rule which is 'This field cannot be left empty' to a custom one.
What I did works with all the other rules (including notEmpty) but does not work for notBlank and I don't understand why....
I tried in the both folowing ways :
$validator
->requirePresence('title', true, MSG_FORM_FIELD_REQUIRED)
->add("title", [
"notBlank" => [
"rule" => "notBlank",
"message" => MSG_FORM_FIELD_REQUIRED
]
]);
OR
$validator
->requirePresence('title', true, MSG_FORM_FIELD_REQUIRED)
->notBlank('title', MSG_FORM_FIELD_REQUIRED);
Am I missing something there ?
notEmptyis deprecated. There used to be twonotEmptyfunctions, only one is deprecated. You can still use$validator->notEmpty(...).notBlankis for use with the$validator->addmethod, like your first example (which does look like it should work...) - Greg Schmidt