Skip to content
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

Editing a Custom Field with Default Value does not pre-populate form with correct value #18557

Closed
mattg66 opened this issue Feb 3, 2025 · 3 comments · Fixed by #18846
Closed
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Milestone

Comments

@mattg66
Copy link

mattg66 commented Feb 3, 2025

Deployment Type

NetBox Docker

NetBox Version

v4.2.2

Python Version

3.10

Steps to Reproduce

Create a custom field with a selection type.
Populate the default value with a string such as "Test"
Save the custom field.

Edit the custom field and the Default Value is populated with Test without the quotations, leading to the forms validation failing. Manually adding the quotations to read "Test" allows the form to be submitted

Expected Behavior

The Default Value textarea should be populated with valid JSON

Observed Behavior

The Default Value textarea is not populated with valid JSON leading to the form validation failing.

@mattg66 mattg66 added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Feb 3, 2025
@DanSheps
Copy link
Member

DanSheps commented Feb 4, 2025

The default value is used when there is no value set. It does not make sense to pre-populate the field with the default value, IMO.

@mattg66
Copy link
Author

mattg66 commented Feb 5, 2025

Hi, This is during the editing of a custom field:

Image

Whereas the entered JSON is the following:

Image

@DanSheps
Copy link
Member

DanSheps commented Feb 5, 2025

Okay, I see what you mean now.

Looks like the quotes are being removed from the json field. Not sure why but yes, that is a bug.

@DanSheps DanSheps added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Feb 5, 2025
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Mar 5, 2025
@jeremystretch jeremystretch added this to the v4.2.6 milestone Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
4 participants