Check when submitting a form if the email is already in the database



I’m trying to create a landing page to preregister our users.

Users will have to submit their email and username. We want to check if the user is already in the database, displaying an error message if that email/username is taken or displaying a success dialog if the email was available and has been recorded.

Also would be nice that each user can register only one username.

Is it possible to make this without making AJAX calls to external servers? And if that’s the only way, how can I set it up?