Implemented conditional validators (see #2406)

See issue #2406