you can validate each request after you received it in controller action.
maybe my code can help you.
$name = $this->request->getPost("name");
$email = $this->request->getPost("email");
$password = $this->request->getPost("password");
$validation = new Validation();
$validation->add(
'name',
new PresenceOf(
[
'message' => 'The name is required',
]
)
);
$validation->add(
'email',
new Email(
[
'message' => 'Email not valid',
]
)
);
$validation->add(
'password',
new PresenceOf(
[
'message' => 'The password is required',
]
)
);
$arr = array(
"name"=>$name,
"email"=>$email,
"password"=>$password
);
$messages = $validation->validate($arr);
if (count($messages)) {
foreach ($messages as $message) {
echo $message, '<br>';
}