Skip to content

Conditional Fields Empty when Hidden #1484

@lucmerceron

Description

@lucmerceron

What version of Unfold are you using?

main

What version of Django are you using?

5.2.2

What browser are you using?

All

Did you checked changelog/commit history, if the bug is not already fixed?

No

Did you searched other issues, if the bug is not already fixed?

Yes

Did you checked documentation?

Yes

Are you able to replicate the bug in the demo site?

Yes

Repository with reproduced bug

N/A

Describe your issue

Steps to reproduce:

  1. Go on live demo on this page: https://demo.unfoldadmin.com/en/admin/formula/driver/56/change/
  2. Status: Active
  3. Fill the Conditional field active with "Fake active data"
  4. Change status to Inactive
  5. Fill the Conditional field inactive with "Fake inactive data"
  6. Submit

Current behavior:

The Conditional field active is also sent with the payload

...
------geckoformboundary5bdd477ff4cc9b7773a4f4a54b98733c
Content-Disposition: form-data; name="status"

ACTIVE
------geckoformboundary5bdd477ff4cc9b7773a4f4a54b98733c
Content-Disposition: form-data; name="conditional_field_active"

Fake active data
------geckoformboundary5bdd477ff4cc9b7773a4f4a54b98733c
Content-Disposition: form-data; name="conditional_field_inactive"

Fake inactive data
...

Expected behavior:

We would expect Unfold to clear / empty (default?) the hidden fields before submitting

...
------geckoformboundary5bdd477ff4cc9b7773a4f4a54b98733c
Content-Disposition: form-data; name="status"

ACTIVE
------geckoformboundary5bdd477ff4cc9b7773a4f4a54b98733c
Content-Disposition: form-data; name="conditional_field_inactive"

Fake inactive data
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions