I am referring to this answer, but the question is valid for any similar answer. The content of the answer is the following one:
form_set_error()
should be called inside yourhook_validate()
function as answered by LSU_JBob.
The answer is first wrong, as a from validation handler is not an implementation of hook_validate()
, which is the hook present in modules implementing a content type to validate the form to build, or edit a node of that content type; a form validation handler is associated to any form, not just node forms. The answer given by LSU_JBob was caused from the fact the OP wrote drupal_set_error()
instead of form_set_error()
; while that answer would have a reason to be written (at least until the OP didn't correct the question), this other answer doesn't have any reason to exist, as it doesn't answer what the question is really asking.
Apart from this, the main problem I see with this answer is that just agrees with a previous answer, without adding anything more. If the answer would have given a different snippet, a link to a documentation page, then the answer could have been better.
To this type of questions I would also include those short answers starting with "I think" and not longer than a line, for which no detail is provided.
What are the criteria to distinguish a comment posted as answer, from a true answer?