fixes #4863 validation does not works for category field

Fixed, tested and committed the code for review, please check it.