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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:17:01+00:00 2026-06-13T19:17:01+00:00

I have a nice modal showing a delete confirmation dialog each time user wants

  • 0

I have a nice modal showing a delete confirmation dialog each time user wants to delete data. The problem is many of my views render a list of elements in the template, and each element has its detail as well as a tiny delete red button. Of course in django the view passes a list of elements to the template, for example a list of clients, and they are rendered in a table like the following:

<table class="table table-striped">  
    <thead>  
      <tr>
        <th>Email</th>
      </tr>  
    </thead>  
    <tbody>
      {% for client in clientes %}
        <tr>  
          <td>{{ client.email }}</td>
          <td>
            <div class="btn-group">
              <!-- Delete button -->
              <a href="#myModal" class="btn btn-danger btn-mini" title="Eliminar">
                <i class="icon-trash icon-white"></i></a>
            </div>
          </td>
        </tr> 
      {% endfor %}
    </tbody>  

I would like to have a Bootstrap modal every time user presses on the delete-button to appear and confirm he is deleting some data. Now, I have managed to make the modal appear and delete the user, but not the correct user, modal somehow its only getting, or trying to delete the first user in the list. You can check my entire template with modal in the following link: FULL HTML

In the end, my problem is somehow related to passing the correct {{ client }} to the modal and not the first one on the list of clients, I’m supposing that happens because of the first declared modal on the for and then does not declare it anymore.

For example, I got 3 clients in the table:

client1@something.com         detele-button
client2@something.com         detele-button
client3@something.com         detele-button

No matter what client delete-button I press, it always shows the modal with client1 data, and actually erases it if press confirm delete.

Thank you.

edit1: href was not ok.

  • 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-06-13T19:17:02+00:00Added an answer on June 13, 2026 at 7:17 pm

    Found the answer for this, actually thanks to keithxm23.

    Checking the generated HTML helped me get this correct. Actually every modal was being correctly generated the problem was that the id property of every modal was set to the same, in this case id="myModal", and the delete button had href="#myModal". the solution was to set the modal id property to a unique value throughout the document, I managed to do that by setting the modal id="{{client.pk}}" and the button href="#{{client.pk}}".

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

Sidebar

Related Questions

I have a nice DataGridView showing what is basically some kind of log data
have a nice day. I got problem when trying to create an image from
I have seen links that open modal windows AND have a nice animation effect
I have a problem with the Dropbox iPad login modal view controller: sometimes you
I have to write an applet that brings up a password dialog. The problem
So, I have a nice domain model built. Repositories handle the data access and
Does anyone have some nice examples of the ajax (modal window) login form popups?
I have the following code that simply uses a jquery ui modal dialog to
Say I have a nice domain model, using (constructor) DI where needed. Now I
I want to replace some headers by images, so I would have nice font.For

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.