adds validation for min-max length

https://www.openproject.org/work_packages/14386
https://www.openproject.org/work_packages/14403
@jonasheinrich please use consistent hash syntax! – one or the other, but not both in the same line or block (I personally prefer the new style).