Field error message from global editor validator
Field error message from global editor validator
Loren Maxwell
Posts: 481Questions: 118Answers: 10
in Editor
For a global validator, can I return the error message to a specific field?
->validator(function ($editor, $action, $data) {
foreach ($data['data'] as $id => $d) {
return "I don't like"; // <- Can I return for a specific field?
}
}
return true;
})
This question has an accepted answers - jump to answer
Answers
There isn't an API to do that - but I think it would be a good idea to add one - thanks for the suggestion.
As a workaround for the moment, what you could do is directly add the field error to the output object - e.g.:
Note that at the moment you still need to return a global error message that will be shown, otherwise the server-side would continue processing the data.
Allan