HTMX Allow updating sub-parts of forms without re-rendering entire form #9254

Open
opened 2025-12-29 20:47:31 +01:00 by adam · 0 comments
Owner

Originally created by @arthanson on GitHub (Feb 15, 2024).

NetBox version

v3.7.2

Feature type

Change to existing functionality

Proposed functionality

Currently we can re-render forms via HTMX when you change a select field to change the fields that are displayed (for example if you add an interface and change the 802.1Q selection).

What happens is the entire form is re-rendered via HTMX (causing a slight flash as the entire form is re-rendered). The proposal would be to allow specifying and updating just a sub-set of the fields, not just the whole form.

Use case

The issue with the current implementation is that on larger forms (like the interface form) There is a UI 'flash' as the entire form is re-rendered. Just updating the subset of fields instead of the whole form should make for a smoother experience.

Discussing with Jeremy this could probably be done by either tying the fields to a fieldset and having HTMX handle rendering of the fieldset, or else using https://htmx.org/attributes/hx-select/ Tying it to a fieldset might also make the implementation of forms more DRY as you could potentially just mark fieldsets as handled via HTMX and the underlying form-view class could auto handle the return info instead of currently how we handle the return in each form-view individually.

Database changes

None

External dependencies

None

Originally created by @arthanson on GitHub (Feb 15, 2024). ### NetBox version v3.7.2 ### Feature type Change to existing functionality ### Proposed functionality Currently we can re-render forms via HTMX when you change a select field to change the fields that are displayed (for example if you add an interface and change the 802.1Q selection). What happens is the entire form is re-rendered via HTMX (causing a slight flash as the entire form is re-rendered). The proposal would be to allow specifying and updating just a sub-set of the fields, not just the whole form. ### Use case The issue with the current implementation is that on larger forms (like the interface form) There is a UI 'flash' as the entire form is re-rendered. Just updating the subset of fields instead of the whole form should make for a smoother experience. Discussing with Jeremy this could probably be done by either tying the fields to a fieldset and having HTMX handle rendering of the fieldset, or else using https://htmx.org/attributes/hx-select/ Tying it to a fieldset might also make the implementation of forms more DRY as you could potentially just mark fieldsets as handled via HTMX and the underlying form-view class could auto handle the return info instead of currently how we handle the return in each form-view individually. ### Database changes None ### External dependencies None
adam added the type: featurenetboxstatus: backlogcomplexity: high labels 2025-12-29 20:47:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9254