-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Enabled" flag is reset during editing of an interface if "802.1Q Mode" is changed #13064
Comments
In my testing, I was only able to replicate this when unchecking the enabled field (or any other checkbox field). This is probably due to a caveat concerning checkbox fields. When the 802.1Q field value is changed, it triggers the form to re-render. All of the current field values are passed and populated in the newly-rendered form, however unticked checkboxes are omitted from this data. This causes checkbox fields to render with their original values (whether checked or unhcecked). Ideally we should force the inclusion of unchecked checkbox fields as well. |
htmx has a function What I was able to get working was only replacing parts of the form with the help of hx-select. To get this working i had to add an id to each field-group, extend the HTMXSelect to ad the This would work for the issue, as the whole 802.1q Group has no checkbox in it. However there could be cases where this would not work, for example if the form group which should be replaced has a checkbox in it which should be preserved. How do you feel about this approach? If desired I can create a pr with this approach. An other solution could be to tag all checkbox with hx-preserve to have htmx preserve them. However I was not able to figure out how to do this. |
@jeremystretch Thank you! |
NetBox version
v3.5.4
Python version
3.10
Steps to Reproduce
Enabled
flag, it doesn't matter if it is checked or not, it just needs to be changed802.1Q Mode
Expected Behavior
The set value (checked or unchecked) for the
Enabled
flag should be preserved during editing of an interface and not be reset to the current actual state when changing anything.Observed Behavior
The state for the
Enabled
flag is reset to the current actual state when802.1Q Mode
is changed.The text was updated successfully, but these errors were encountered: