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

Boolean Form Submission Error in Business Forms Panel 4.8.0 with Grafana 11.1.0 - Form Element: Radio group with boolean options #552

Open
m4v3rickmts opened this issue Nov 15, 2024 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@m4v3rickmts
Copy link

Git Issue: Boolean Form Submission Error in Business Forms Panel 4.8.0 with Grafana 11.1.0

Summary

When using the Business Forms Panel (v4.8.0) in Grafana (v11.1.0), submitting a boolean field with a value of false results in an error. This issue arises due to the undefined value being sent in the update statement for false.

Steps to Reproduce

  1. Set up a Grafana dashboard with:
    • Two form panels for numeric inputs.
    • One form panel using a "Radio group with boolean options".
  2. Connect the form panels to a PostgreSQL database.
  3. Ensure the database field for the boolean is initially set to false.
  4. Perform the following actions:
    • Set the boolean form to true and submit: ✅ Submission succeeds.
    • Set the boolean form to false and submit: ❌ Submission fails.

Observed Behavior

  • When setting the boolean field to true, the update statement correctly sends true as the value.
  • When setting the boolean field to false, the update statement sends undefined, resulting in an error.

Expected Behavior

  • The update statement should send false when the boolean field is set to false, as displayed correctly in the "Update Confirmation Window".

Environment

  • Business Forms Panel: 4.8.0
  • Grafana: 11.1.0
  • Database: PostgreSQL

Additional Notes

The issue seems to originate from how the form panel processes and serializes boolean values during submission. The discrepancy between the "Update Confirmation Window" and the actual update statement may offer a clue.

Request

Can this behavior be verified and addressed? If additional debugging or testing is needed, please provide guidance.

Thanks

@mikhail-vl
Copy link
Member

mikhail-vl commented Nov 17, 2024

@m4v3rickmts Do you create payload using custom code with if statement? If yes, please remove it to send element's values as is.

@mikhail-vl mikhail-vl self-assigned this Nov 17, 2024
@mikhail-vl mikhail-vl added the question Further information is requested label Nov 17, 2024
@mikhail-vl mikhail-vl moved this to In progress in Business Suite Nov 17, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Business Suite Nov 17, 2024
@m4v3rickmts
Copy link
Author

@mikhail-vl I set the "Custom Code" (Initial Request) field to empty but still the same issue.
I tried it with both "Custom Code" fields but the error with "undefined" won't be solved.

Any ideas?

@mikhail-vl mikhail-vl moved this from Done to Ready in Business Suite Nov 18, 2024
@mikhail-vl
Copy link
Member

@m4v3rickmts I will try to reproduce and get back to you.

@mikhail-vl mikhail-vl reopened this Nov 18, 2024
@m4v3rickmts
Copy link
Author

Meanwhile I am using a workaround:
isactive=case when '${payload.isactive}'='true' then true else false end

I check if it is true and update the table with true, else with false. But I am sure it would be much more convenient if the radio group return was either true or false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Ready
Development

No branches or pull requests

3 participants