Rails provides validation in ActiveModel, where you can write validation rules on ActiveRecord attributes or any custom validator. For client side validations, I am mostly prefering gem client_side_validations. The benefit of using this gem is minimal configuration and one place to define validation rule. When you define validation in your rails model, this gem will validate attributes based on validation defined in your model with minimum configuration. You can go over its usage page for configuration.
I want to describe case where I need to implement conditional validation. i.e. presense of dependent field. For example, for user where he don't find his state in states dropdown then he can select other in listed in dropdown after that user have to fill another input field other state. In this case there are two ways to solve. One is either you define your own validator in middleware server side or use core javascript functions of client_side_validaiton library. I ended with using core javascript library because it was little straight forward and less code.
Here is the implementation I did for solution :
That's it. No more coding and its done. This is how I have implemented conditional validation at client side.
Hope that helps!!!!