Leverage HTMX for confirmation dialogs #5875

Closed
opened 2025-12-29 19:33:44 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jan 5, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.1.4

Feature type

Change to existing functionality

Proposed functionality

Currently, when deleting an object, two requests are made:

  1. The user clicks delete and is taken to the deletion confirmation form.
  2. The user submits the confirmation form, the object is deleted, and the user is redirected to the return URL.

It should be trivial to instead use a modal dialog to display the confirmation form. The proposed workflow would be:

  1. The user clicks delete and an HTMX request is made to retrieve the confirmation form (and any relevant information, such as related objects). The form is rendered in a modal and displayed, but the user remains on the original page.
  2. The user submits the confirmation form, the object is deleted, and the user is redirected to the return URL.

Although we're still technically making two requests, the first loads only the confirmation form and avoids a complete page request.

We should be able to implement this entirely within the relevant generic view classes.

Use case

Loading the confirmation dialog via HTMX avoids a full page refresh and greatly reduces the time needed to delete an object (and especially to abort the deletion of an object).

Database changes

No response

External dependencies

No response

Originally created by @jeremystretch on GitHub (Jan 5, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.1.4 ### Feature type Change to existing functionality ### Proposed functionality Currently, when deleting an object, two requests are made: 1. The user clicks delete and is taken to the deletion confirmation form. 2. The user submits the confirmation form, the object is deleted, and the user is redirected to the return URL. It should be trivial to instead use a modal dialog to display the confirmation form. The proposed workflow would be: 1. The user clicks delete and an HTMX request is made to retrieve the confirmation form (and any relevant information, such as related objects). The form is rendered in a modal and displayed, but the user remains on the original page. 2. The user submits the confirmation form, the object is deleted, and the user is redirected to the return URL. Although we're still technically making two requests, the first loads only the confirmation form and avoids a complete page request. We should be able to implement this entirely within the relevant generic view classes. ### Use case Loading the confirmation dialog via HTMX avoids a full page refresh and greatly reduces the time needed to delete an object (and especially to abort the deletion of an object). ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:33:44 +01:00
adam closed this issue 2025-12-29 19:33:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5875