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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:17:57+00:00 2026-05-26T19:17:57+00:00

In my web app, I have a list of editable objects, each with an

  • 0

In my web app, I have a list of editable objects, each with an “edit” link. Now, when you click the “edit” link, a jQuery UI dialog pops up, and the edit form for that object is displayed. On the bottom are “save” and “cancel” buttons. when “save” is clicked, the form is supposed to be submitted to the server. That’s what I’m unable to do.

Some particularities are that the edit form is loaded onto the dialog div via ajax when “edit” is clicked on one of the list items, so maybe it has something to do with that. Here are some code excerpts from the app. I’m working with Ruby on Rails 3.1.

The view:

<html>
...
<body>
    ...
    <div id="edit-campaign"></div>
    <script>
    $(function() {
    var buttons = { 
            "Save": function() { $("#edit-campaign-form").submit(); },
            "Cancel": function() { $("#edit-campaign").dialog("close"); }
              };
    createDynamicDialog("edit-campaign", buttons, "edit-campaign", "Edit Campaign");
    });
    </script>
</body>
</html>

The createDynamicDialog function (in another script file): This is the one where I make each “edit” link load their edit forms (URL in the href attribute) onto UI dialogs.

createDynamicDialog = function(divId, buttons, cls, title) {
    $("." + cls).click(function(e) {
        e.preventDefault();
        var dialogOptions = {   
                                title: title,
                                width: 800,
                                height: 500,
                                modal: true,
                                autoOpen: true,
                                buttons: buttons
                            };
        var link = $(this);
        $("#" + divId).load(link.attr('href')).dialog(dialogOptions);
    });
}; 

With this, the “cancel” button works fine (closing the dialog), but the form isn’t submitted when I click “save”. Why could this be? I have a similar dialog that is loaded (the ajax part) when the page is loaded, and is only toggled through a button. That works fine. The problem is only when the loading of the form is done on the “click” event. Why?

Thanks in advance for any help you can give me. I’ve been stuck on this forever…

  • 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-26T19:17:58+00:00Added an answer on May 26, 2026 at 7:17 pm

    You could try changing this line of code:

    "Save": function() { $("#edit-campaign-form").submit(); },
    

    to

    "Save": function() { $("#edit-campaign form").submit(); },
    

    I can’t tell what the generated form would look like, but changing the save button in this way should work. [I suspect the generated form doesn’t have the id you expect]

    update/edit

    To reflect what we covered in the comments: When events are not being captured as expected, it’s important to check for other listeners that may be consuming the event.

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

Sidebar

Related Questions

I have ASP.NET MVC 3 web app and List of objects List<ConversionModel> Queue I
Let's say I have a list of categories for navigation on a web app.
I have a web app where I need to change a drop down list
This is the scenario i have: im developing a web app that will list
Background: I'm writing ASP.NET MVC 3 Web app. I have a List<MyObject> (actually several
I have a web.xml which looks like: <web-app> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <security-constraint> <web-resource-collection> <web-resource-name>Default</web-resource-name>
I have a list view in my RoR web app. The view is a
In my web app I have a dynamically generated form that I use to
I'm developing an web app using asp.net mvc. I have a List in Cache
I have a list of items in my web app. Currently these have a

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.