Using the enter key to submit a form during object creation defaults to "save & add another" #6517

Closed
opened 2025-12-29 19:41:52 +01:00 by adam · 6 comments
Owner

Originally created by @amit177 on GitHub (May 27, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.3

Python version

3.9

Steps to Reproduce

  1. Install netbox
  2. Add a rack
  3. Add a new device to the rack
  4. Add an interface to the device and press enter instead of clicking on the Create button
  5. It will refresh the page instead of redirecting to redirect_url

Expected Behavior

The website should redirect to the link in the redirect_url parameter

Observed Behavior

The website redirects to the same page again as if "create & add another" was clicked

Originally created by @amit177 on GitHub (May 27, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.3 ### Python version 3.9 ### Steps to Reproduce 1. Install netbox 2. Add a rack 3. Add a new device to the rack 4. Add an interface to the device and press enter instead of clicking on the Create button 5. It will refresh the page instead of redirecting to `redirect_url` ### Expected Behavior The website should redirect to the link in the `redirect_url` parameter ### Observed Behavior The website redirects to the same page again as if "create & add another" was clicked
adam added the type: bugstatus: accepted labels 2025-12-29 19:41:52 +01:00
adam closed this issue 2025-12-29 19:41:52 +01:00
Author
Owner

@amit177 commented on GitHub (May 27, 2022):

https://github.com/netbox-community/netbox/issues/7823
looks like it was resolved just for that form and not for the rest

@amit177 commented on GitHub (May 27, 2022): https://github.com/netbox-community/netbox/issues/7823 looks like it was resolved just for that form and not for the rest
Author
Owner

@jeremystretch commented on GitHub (May 31, 2022):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (May 31, 2022): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@amit177 commented on GitHub (Jun 2, 2022):

@jeremystretch
There are too many forms to list, I can't list all of them, but here are a few:

  • Add interface to device
  • Add IP to interface
  • Add inventory item to device
  • Add console port to device
  • Add power port to device

Basically, any form that has redirect_url in the URL and has more than one submit button (i.e, both Create and Create & Add Another or Save and Save & Continue Editing)

You can see the github issue I've mentioned in the previous reply for more information, you've resolved this in the past for only one form.

@amit177 commented on GitHub (Jun 2, 2022): @jeremystretch There are too many forms to list, I can't list all of them, but here are a few: - Add interface to device - Add IP to interface - Add inventory item to device - Add console port to device - Add power port to device Basically, any form that has `redirect_url` in the URL and has more than one submit button (i.e, both Create and Create & Add Another or Save and Save & Continue Editing) You can see the github issue I've mentioned in the previous reply for more information, you've resolved this in the past for only one form.
Author
Owner

@jeremystretch commented on GitHub (Jun 2, 2022):

There are too many forms to list,

You only need to use one as an example. The key is to provide exact instructions that someone else can follow to confirm whether or not they can reproduce the bug.

@jeremystretch commented on GitHub (Jun 2, 2022): > There are too many forms to list, You only need to use one as an example. The key is to provide exact instructions that someone else can follow to confirm whether or not they can reproduce the bug.
Author
Owner

@amit177 commented on GitHub (Jun 2, 2022):

  1. Install netbox
  2. Add a rack
  3. Add a new device to the rack
  4. Add an interface to the device and press enter instead of clicking on the Create button
  5. It will refresh the page instead of redirecting to redirect_url
@amit177 commented on GitHub (Jun 2, 2022): 1. Install netbox 2. Add a rack 3. Add a new device to the rack 4. Add an interface to the device and press enter instead of clicking on the Create button 5. It will refresh the page instead of redirecting to `redirect_url`
Author
Owner

@jeremystretch commented on GitHub (Jul 19, 2022):

  1. It will refresh the page instead of redirecting to redirect_url

This is not accurate. The form is being submitted using the "Create & Add Another" submission button, because it appears before the regular "Create" button. The interface is being created successfully (as indicated by the success message), and the user is redirected back to the interface creation page.

I'm not sure what the intent was re: #7823 but it should never be necessary to use Javascript to submit the form.

All we need to do to make the "create"/"save" button default is to reorder the buttons so that it appears first.

@jeremystretch commented on GitHub (Jul 19, 2022): > 5. It will refresh the page instead of redirecting to redirect_url This is not accurate. The form is being submitted using the "Create & Add Another" submission button, because it appears before the regular "Create" button. The interface is being created successfully (as indicated by the success message), and the user is redirected back to the interface creation page. I'm not sure what the intent was re: #7823 but it should never be necessary to use Javascript to submit the form. All we need to do to make the "create"/"save" button default is to reorder the buttons so that it appears first.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6517