简体   繁体   中英

Devise User Registration with Javascript Login

I have a working registration form with validation and all that - and some other fields for other models. Now I need to add some client-side validation which checks the email for uniqueness. If it's taken the fields for the user model should be replaced with login fields.

Not sure where and how to start.

My suggestion would be to write an own method in your controller that accepts ajax calls, wich gets triggered on onblur of the email field (and of course sends the email data).

The controller method checks if the given email address exists in your database. If so you can render a ERB-Javascript template which replaces your existing registration form with the login form rendered in the template.

Hope it's clear what I mean.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM