My goal is to validate a specific text field where this field is dependent to the value of the other element.
For example I have a select field and an input text field.
Input text is required only when select tag has a selected value.
Hope someone can help.
Take a look at
In our project we are using, Backbone validator, integrated with Bootstrap
Sample of integration Backbone.validation & Bootstrap
https://jsfiddle.net/thedersen/c3kK2/
That is if you are using Backbone :)
For bootstrapvalidator there is a callback method for validation
http://bootstrapvalidator.com/validators/callback/
From example:
And JS
You can implement arbitrary validation with it.
So your validation can be implemented through some global function
With HTML
with JS
And you need to be creative with element attributes, to link related elements correctly.