jquery - How can I get the devise error messages in a pop up -
i using jquery load signup form of devise popup. problem not able load error messages of devise in popup.
if click on empty signup form redirected page see error message.
i have gone through github posts of devise not find solution looking for.
i have created method in application helper <%= devise_error_messages! %>
code in form helper works properly.
the application helper code follows :-
def devise_error_messages! resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join end
i know wrong cannot figure out what. can please me out one.
update
i think since errors not showing in pop box when hit submit button, there might issue registration controller's create action. try override default create action of registration controller of devise. lets see if works these change.
update 2
made changes mentioned in update above although not working gives feeler close solution :)
still waiting help.
thanks,
are overriding create action of registrationscontroller? should trick if resource.save fails
render :json => { :success => false, :data => resource.errors.full_messages }
that should hand error messages jquery script. example:
$('#sign_up_form').submit(function() { $.post(this.action, function(response) { if (response.success) { //... redirect or cuz we're registered } else { // errors $('#sign_up_form').prepend(response.data); } }, 'json'); });
Comments
Post a Comment