Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:06:56+00:00 2026-05-25T19:06:56+00:00

I have a form as follows: <%= form_for(:session, :url => sessions_path, :remote => true,

  • 0

I have a form as follows:

<%= form_for(:session, :url => sessions_path, :remote => true, :html => {:id => 'login_form'}) do |f| %>
    <div class="formRow">
        <%= f.label :email      %><br>
        <%= f.text_field :email, :value => (@email if @email) %>
    </div>
    <div class="formRow">
        <%= f.label :password      %><br>
        <%= f.password_field :password %>
    </div>
    <div class="formRow small">
        <%= link_to "I forgot my password",'#' %>       
    </div>
    <div class="formRow">
            <%= f.submit signin_button_text, :class => "button-big left" %>
    </div>
<% end %>

It goes to this controller:

def create
        @email = params[:session][:email]
        user = User.authenticate(params[:session][:email],params[:session][:password])
        respond_to do |format|
        if user.nil?
          @title = "Sign in"
          flash.now[:error] = "Invalid email/password combination"
          format.js {render :action => :new }
        else
          sign_in user 
           format.js {render :action => :create }
        end
      end
    end

Here is the new.js file:

$('#login_form').replaceWith("<%=escape_javascript(render 'login_form')%>");
if($('.flash-block').length ==0) {
$('#login_form').before("<div class='flash-block error'><span><%=escape_javascript(flash[:error])%></span></div>");
                            }

For some reason if the form is submitted with errors it loops four times.

I don’t understand why.

Is there something in the code that causes this to loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:06:57+00:00Added an answer on May 25, 2026 at 7:06 pm

    I was using Fancybox and was not opening it in an iframe. So I wound up loading the jquery libraries twice and thus when I submitted the form I had multiple submissions.

    Once I opened Fancybox in an iframe it submitted only once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a html form for uploading a file, which is as follows: $uploadhtml
My Rails form code is as follows: <%= form_for(resource, :as => resource_name, :url =>
I have a class that follows the form: public class Cat { public string
I have rails app with a textarea form like <%= form_for Comment.new, :remote =>
I have a form (edited for brevity) as follows: class InteractionForm(forms.Form): def __init__(self, *args,
I have a simple email address sign up form as follows: <form action= id=newsletterform
Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text
I have an HTML form page which I post back to itself in order
I have a Model as follows: class TankJournal(models.Model): user = models.ForeignKey(User) tank = models.ForeignKey(TankProfile)
SO I have a setup with a few links as follows <a class=someclass href=http://www.google.com

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.