vaadin / vaadin/framework

Binder with DateField is not persisting null values after validation error

Open
#11,723 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Vaadin Framework version

Tested with 8.9.0

Browser version

Chrome Version 76.0.3809.132

Web container name and version

Jetty 9.3.9.v20160517

Description of the bug

By using a DateField with Binder, with a non-required field, cleaning the value will persist a null to the Bean, but if the value is cleared after a validation/conversion error, then the null is not persisted to the Bean.

Minimal reproducible example

See attached project
Video showing the problem:
DateTimeFieldProblem2
The last part of the video shows that after clearing the DateField and loosing focus, the null value is not persisted.

Expected behavior

The null value should be written to the underlying bean after a validation error.

Actual behavior

The null value is not persisted to the underlying bean after a validation error. If a valid value is filled in and then cleared then the null value is persisted.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached minimal reproducible project and trace the DateField and Binder validation/conversion flow after a value is cleared. Confirm the behavior with a validation error, then verify that clearing the field persists null to the underlying bean and that the existing valid-value-then-clear case remains working.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.