datetimepicker binder

The documentation for datetimepicker and form binding seems to indicate that the conversion between string and localdate is done automatically without needing a converter but when I try this I get error

There was an exception while trying to navigate to ‘Contacts/Individual’ with the root cause ‘java.lang.IllegalStateException: Property type ‘java.lang.String’ doesn’t match the field type ‘java.time.LocalDate’. Binding should be configured manually using converter.’

If a converter is necessary is there a Vaadin supplied one?

There is no such thing as automatic string to localdate transformation on the server side. Your bean’s property has to be of type LocalDate if you wanna work without converters.

My bean’s property is LocalDate, sorry for lower case😀

Okay that sounds confusing and you are sure you are binding it to a DateField and not a TextField by accident?

I can check further, the confirmation that it can be done without converter is probably all I need to proceed to find the problem, thanks for now, get back later if necessary.

Just to make sure you are using a DatePicker for LocalDate and DateTimePicker if you wanna map LocalDateTime

DateTimePicker’s value type on the server is LocalDateTime. So while you can type text into the input field(s) in the ui, the server-side component knows nothing about Strings

@forthcoming-giraffe could you link to the documentation you mentioned? We might want to rephrase it.

Hi Rolf,

`Binding Data to Forms
How to bind data to forms, which are composites with multiple fields that each bind to sub-structures in data.

How to Bind Form Data
Binding Read-Only Data

In many applications, users provide structured data by completing fields in forms. This data is typically represented in code as an instance of a business object (JavaBean), for example a Person in an HR application.

The Binder class allows you to define how the values in a business object are bound to fields in the UI.

Binder reads the values in the business object and converts them from the format expected by the business object to the format expected by the field. It also handles the reverse process, converting values from UI fields to the format expected by the business object.

Binder can only bind components that implement the HasValue interface, for example TextField and ComboBox.

It’s also possible to validate user input and present the validation status to the user in different ways.
`

The comment “Binder reads the values…” does not give any indication of the types that are handled by the binder.

Perhaps a list of the types auto handled might help.

I am having a problem at present with boolean so it would be helpful to have a list to confirm that boolean is handled by the binder.

Then if there is a problem no time needs to be wasted trying to establish if it is “boolean” not handled or a problem somewhere else in my code.

How do I do a line feed in discord? :innocent:

shift+enter