actually you shouldn't mix up server side and client side code.
validate method can be invoked only in server side... So there is no way to use this method on client side.
You need to write your own JS side validation as the same as server side validation.