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

  • Home
  • SEARCH
  • 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 6472147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:18:32+00:00 2026-05-25T06:18:32+00:00

I have a form which I’m putting in a IFrame within a page. The

  • 0

I have a form which I’m putting in a IFrame within a page. The IFrame displays a rails form with a button to save and a cancel link.

I add the iFrame with this code:

 $('#saveAreaForm').contents().find('#cancel_save').click(function() {
                $('#saveAreaForm').remove();
            });

             $('#saveAreaForm').contents().find('#create_area_form').bind("ajax:failure", function(xhr, status, error) {alert("failure!");});
            $('#saveAreaForm').contents().find('#create_area_form').bind('ajax:success', function(xhr, status, error) {alert("failure!");});

The link to remove the form works fine but the callbacks are never triggered.

I see in the console that the controller code is triggered but I’m unable to receive either success or failure.

This is the form code (HAML):

= simple_form_for(@area, :remote => true, :html => { :'data-type' => 'html', :id => 'create_area_form' }) do |f|
  - if @area.errors.any?
    #errorExplanation
      %h2= "#{pluralize(@area.errors.count, 'error')} prohibited this user from being saved:"
      %ul
      - @area.errors.full_messages.each do |msg|
        %li= msg

  .field
    = f.label :name
    %br
    = f.text_field :name
  .field
    %br
    = f.association :area_group

    %br
  .actions
    = f.submit
    = link_to 'Cancel', '#', {:id => 'cancel_save'}

And this is the controller function:

  # POST /areas
  # POST /areas.xml
  def create
    @area = Area.new(params[:area])

    respond_to do |format|
      if @area.save
        format.html { redirect_to(@area, :notice => 'Area was successfully created.') }
        format.xml  { render :xml => @area, :status => :created, :location => @area }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @area.errors, :status => :unprocessable_entity }
        format.json { render :json => @area.errors, :status => :unprocessable_entity }
      end
    end
  end

Is there something obvious which I’m overlooking?

  • 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-25T06:18:33+00:00Added an answer on May 25, 2026 at 6:18 am

    The problem was that the bind statement was probably called before the DOM objects were created. I solved the problem by using live instead of bind.

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

Sidebar

Related Questions

I have a form which users can add controls to and when they right
I have django form which displays the check boxes.After selecting the checkboxes user will
I have a form which is supposed to be redirected to order success page
I have a form which is overlayed over the visitors current page using jQuery
I have a form which has a input textbox and submit button. On submission
I have web form in which I have to make sure that 'SUBMIT' button
i have a Form which has a button, on the button click event, a
I have a form which renders, but when I click the submit button, I
I have a form which contain some radio button and check-boxes . Whenever user
I have a form which changes the inputfields depending on a radio-button. for text

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.