Control visible form fields with query parameter #9970

Closed
opened 2025-12-29 21:25:04 +01:00 by adam · 1 comment
Owner

Originally created by @alehaa on GitHub (Jul 11, 2024).

NetBox version

v4.0.7

Feature type

New functionality

Proposed functionality

Add a new query parameter to limit visible form fields of the NetBoxModelForm class. Fields can be separated by commas. Required fields are always visible, regardless of whether they are passed or not, except an initial value is already defined.

Use case

It's already possible to define query parameters for initial values and a return URL. Allowing this feature request would allow existing forms of NetBox to be reused for custom functionality.

A practical example for my local setup would be to create custom links on specific NetBox pages, where the user only has to fill in the fields that are needed in the situation. I.e. for a location a new custom link button Add Access Point could be added, which adds a new Access Point in this location, but only asks for its name and serial number. All other fields would be hidden, allowing the user to focus on that task.

Combined with the existing query parameter for specifying a return URL, plugins could use this mechanism to reuse forms, limit the fields to those necessary for the custom workflow, and then hook back into the plugin's logic.

Database changes

None

External dependencies

None


When accepted, I can work on a PR for this feature.

Originally created by @alehaa on GitHub (Jul 11, 2024). ### NetBox version v4.0.7 ### Feature type New functionality ### Proposed functionality Add a new query parameter to limit visible form fields of the `NetBoxModelForm` class. Fields can be separated by commas. Required fields are always visible, regardless of whether they are passed or not, except an initial value is already defined. ### Use case It's already possible to define query parameters for initial values and a return URL. Allowing this feature request would allow existing forms of NetBox to be reused for custom functionality. A practical example for my local setup would be to create custom links on specific NetBox pages, where the user only has to fill in the fields that are needed in the situation. I.e. for a location a new custom link button `Add Access Point` could be added, which adds a new Access Point in this location, but only asks for its name and serial number. All other fields would be hidden, allowing the user to focus on that task. Combined with the existing query parameter for specifying a return URL, plugins could use this mechanism to reuse forms, limit the fields to those necessary for the custom workflow, and then hook back into the plugin's logic. ### Database changes None ### External dependencies None --- When accepted, I can work on a PR for this feature.
adam added the type: featurestatus: duplicate labels 2025-12-29 21:25:04 +01:00
adam closed this issue 2025-12-29 21:25:05 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 11, 2024):

This idea has been proposed in the past and rejected, because it will inevitably lead to confusion from users attempting to follow written documentation that does not match what they see in the user interface. The development burden such an implementation would impose is also disproportionate to the value it provides.

If there are specific workflows or use cases where you want to streamline operations by providing only certain fields to the user, this is easily accomplished using a custom script or, for advanced cases, a plugin.

@jeremystretch commented on GitHub (Jul 11, 2024): This idea has been proposed in the past and rejected, because it will inevitably lead to confusion from users attempting to follow written documentation that does not match what they see in the user interface. The development burden such an implementation would impose is also disproportionate to the value it provides. If there are specific workflows or use cases where you want to streamline operations by providing only certain fields to the user, this is easily accomplished using a [custom script](https://netboxlabs.com/docs/netbox/en/stable/customization/custom-scripts/) or, for advanced cases, a [plugin](https://netboxlabs.com/docs/netbox/en/stable/plugins/).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9970