Disabling 802.1Q mode on interfaces don't clear untagged vlan assignment #4288

Closed
opened 2025-12-29 18:34:26 +01:00 by adam · 1 comment
Owner

Originally created by @miaow2 on GitHub (Nov 19, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.8
  • NetBox version: 2.9.4

Steps to Reproduce

  1. set on interface (on device or vm) 802.1Q Mode (any mode) and Untagged VLAN
  2. set 802.1Q Mode to None, fields with vlans disapear
  3. set any 802.1Q Mode again, field Untagged VLAN will be filled with VLAN from step 1

If you save after step 2, 802.1Q Mode will change, but Untagged VLAN stays on interface.

Expected Behavior

Untagged VLAN field should be empty

Observed Behavior

Untagged VLAN field does not clear, with Tagged VLANs field all works fine.

On my enviroment I fix this in file project-static/js/forms.js line 351 by sending empty string to val() function.

$('select#id_untagged_vlan').val('');

I don't know is this a good solution, so I open this issue

Originally created by @miaow2 on GitHub (Nov 19, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.8 * NetBox version: 2.9.4 ### Steps to Reproduce 1. set on interface (on device or vm) 802.1Q Mode (any mode) and Untagged VLAN 2. set 802.1Q Mode to None, fields with vlans disapear 3. set any 802.1Q Mode again, field Untagged VLAN will be filled with VLAN from step 1 If you save after step 2, 802.1Q Mode will change, but Untagged VLAN stays on interface. ### Expected Behavior Untagged VLAN field should be empty ### Observed Behavior Untagged VLAN field does not clear, with Tagged VLANs field all works fine. On my enviroment I fix this in file `project-static/js/forms.js` line [351](https://github.com/netbox-community/netbox/blob/develop/netbox/project-static/js/forms.js#L351) by sending empty string to `val()` function. ``` $('select#id_untagged_vlan').val(''); ``` I don't know is this a good solution, so I open this issue
adam added the type: bugstatus: accepted labels 2025-12-29 18:34:26 +01:00
adam closed this issue 2025-12-29 18:34:26 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 20, 2020):

This line seems to be the problem. Since we moved to slugs for choice fields, the mode field now stores an empty string rather than null.

@jeremystretch commented on GitHub (Nov 20, 2020): [This line](https://github.com/netbox-community/netbox/blob/58668a680754604937bed83591d3505bce7f6da7/netbox/dcim/models/device_components.py#L730) seems to be the problem. Since we moved to slugs for choice fields, the `mode` field now stores an empty string rather than null.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4288