when I focus on the password field.
I want to validate the email and show the error message on the page without refreshing the whole inputs that user has given.
I need to validate this using the database. whether the email is exists or not.
I think i want jquery. But i don't know how to access jquery though the controller.
I am using zendframework 2.
I suggest you break this problem into parts. You must have server side validation, so start by getting that figured out. You post the form, validation is run, and validation messages are attached to invalid form elements.
This is not as bad as it sounds, because it loads the users values back into the form by default.
The fact that you are checking for uniqueness makes your use case a bit trickier, because you will need a custom validator that can interact with your database, and you haven't specified if you're using Zend\Db, Doctrine, or maybe even something else. In any case, you should start by looking at the default validator package:
http://framework.zend.com/manual/2.2/en/modules/zend.validator.html
Some common things we'd want to do with database validation are often part of the persistence package. Your use case is actually given as the example in the Db\Adapter tutorial:
http://www.zendframework.com/manual/2.1/en/tutorials/tutorial.dbadapter.html
How you implement this will depend a lot on how you're handling persistence.
If you haven't considered Doctrine yet, read through this slide show from Ocramius:
http://ocramius.github.io/presentations/doctrine2-zf2-introduction/#/1
Next, you can enhance the use experience as you described by adding a validation service endpoint, and calling that via Ajax. It should use the exact same validator that the form uses, but provide the feedback on a JavaScript event.
I recommend you look at the form quick start here https://packages.zendframework.com/docs/latest/manual/en/modules/zend.form.quick-start.html
It might seem a bit daunting, because they cover a lot of ground, but it does have a specific example for email basic validation. Once you have implemented your uniqueness validator, it will be added to the form in the same way.
Hope that's helpful.