I have the following validation:
$validator
->requirePresence('bid_id', 'create')
->notEmpty('bid_id', 'This field cannot be left empty', function ($context) {
return $context['data']['type'] === 'Awarded Bid';
});
When I try to submit, I get this:
So the error message is correct, but it returns undefined index for some reason. I added a debug($context['data'])
in the validator just before the return
, and this gives output at the top of the page (the whole $context['data']
-array) but right above the field - above the notice - it prints an empty array as seen below.
Why is this happening and how do I stop it?