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

Removing custom field value changes text to null instead of empty string #502

Open
RaduNico opened this issue Nov 16, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@RaduNico
Copy link

RaduNico commented Nov 16, 2023

When creating a new finding, all custom values added for that finding are created in the database with the value "" (empty string). If a value is assigned to that custom field and then deleted using the X (see picture), the value is represented with null in the database.

EDIT: Attempting to use the length conditional ({#retestrisk | length}SHOW IF NOT EMPTY{/retestrisk | length}) instead of equality with empty string results in a parsing error (second picture).

To Reproduce

  1. Create custom fields with 1 value
  2. Add a finding which contains that custom field and save. At this point the database will contain the finding with the custom field text set to ""
  3. Change the value of the custom field to the existing value and save the finding
  4. Remove the value and save the finding. At this point the database will have the custom field text value set to null

Expected behavior
Removing the value should reset the field back to the default empty string. This way if you check if the value is empty in the template it can be done using equality with empty string.

Screenshots
image

image

@RaduNico RaduNico added the bug Something isn't working label Nov 16, 2023
@RaduNico
Copy link
Author

Found a bypass for this issue. The following tags can be used in the template:

{#customfield != ''}{#customfield != undefined}SHOW IF NOT EMPTY{/customfield != undefined}{/customfield != ''}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant