Value constraints of dependened field in input type

So I have a tricky question. Is there a way to either validate or make visible if input fields depend on other input fields of the same input type?
for example if name is longer than 8 characters then field toLong must be true and field shorten can only be ['1char', '4chars'] it is just a made up example I hope you get what I mean.
usually you can only have constraints for the field itself, like what type it is or how long and so on. but is it possible to have input validation with dependent fields?