Topic: Clearing an optional appointment still sends its previous value

Elise Moore priority asked 1 week ago


The appointment field is optional. After choosing a date, clearing the visible input and saving the form still sends the earlier timestamp from our draft object.

We update that object only when the picker returns a valid selection, so an empty input does not replace its previous value. The endpoint accepts null to remove an appointment. Should an empty selection be handled separately?


Igor Przybysz staff answered 1 week ago


Yes. Clearing this optional field is a meaningful update, not an invalid selection to ignore. Set the draft's appointment value to null when the input is empty, and make sure the submit handler serializes that updated state rather than a previously cached timestamp.

Keep invalid nonempty text distinct from an intentional clear: show validation for invalid text, while an empty value becomes the null your endpoint expects. Apply that rule in the same path used by both the picker's clear action and manual edits.

https://mdbootstrap.com/docs/standard/forms/datetimepicker/



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 9.3.0
  • Device: Laptop
  • Browser: Firefox
  • OS: Ubuntu
  • Provided sample code: No
  • Provided link: No