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 7446227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:16:05+00:00 2026-05-29T12:16:05+00:00

I have a problem. I have form inside a fancybox. This form have a

  • 0

I have a problem. I have form inside a fancybox. This form have a file field.

<div style="display:none"><div id="avatar_form">
      <%= form_for @user do |f| %>
      <%= f.file_field :avatar, :value => @user.profile.avatar %><br/>
      <%= f.submit "Change Avatar"  %><br/>
      <% end %>
</div></div>

But after clicking a button for choosing file fancy box is closing. But i dont want it to close.

This calls a fancy box

$("a#avatar").fancybox();

and here is ajax

$("#edit_user").bind("submit", function() {
    $.fancybox.showActivity();
    $.ajax({
        type        : "POST",
        cache   : false,
        url     : "anyurl",
        data        : $(this).serializeArray(),
        success: function(data) {
            $.fancybox(data);
        }
    });
    return false;
});

What i am doing wrong? i dont know what to do. Thanks in advance!

  • 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-29T12:16:06+00:00Added an answer on May 29, 2026 at 12:16 pm

    Hmmm. I would first try stopping the file input from propagating any events up the DOM tree, which might be unwantedly triggering a close event:

        success: function(data) {
            $.fancybox(data);
            $("#avatar_form > form > input[type='file']").on("click change", function (e) {
                e.stopPropagation();
            });
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whether we can have a form inside another form?. Is there any problem with
I have jQuery Datepicker inside my form. My problem is after I have clicked
I have a description textarea inside a form where user may enter a description
I have a Delphi form inside a DLL (I know that this restricts the
I have problem with TinyMCE editor. I have form with few text fields and
I have problem in declaring the intents on my app. I have a form
I have a problem. The client is claiming that a prize signup form I
i have an asp.net form and an asp:textbox. i have a problem when the
i have bought a template that have built in contact form problem is that
I have the following problem: I have a form in site/banen (currently local running

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.