diff options
author | Denis Anisimov <denis@vaadin.com> | 2016-08-16 16:09:35 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-08-17 07:48:06 +0000 |
commit | c91703aff22b3ef8adaf86afb82c50a344f1ab76 (patch) | |
tree | 672a3b62f755c23e70bb8e9e632339a9df8b3b24 /documentation/datamodel/datamodel-forms.asciidoc | |
parent | a5575a9252f4e502624079c65c7080e741846692 (diff) | |
download | vaadin-framework-c91703aff22b3ef8adaf86afb82c50a344f1ab76.tar.gz vaadin-framework-c91703aff22b3ef8adaf86afb82c50a344f1ab76.zip |
Test that cross field validation works as expected (#33).
Test for cross field validation from Book of Vaadin.
Change-Id: Ida338bd79456332b3a359217ea7b9900a1408153
Diffstat (limited to 'documentation/datamodel/datamodel-forms.asciidoc')
-rw-r--r-- | documentation/datamodel/datamodel-forms.asciidoc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/documentation/datamodel/datamodel-forms.asciidoc b/documentation/datamodel/datamodel-forms.asciidoc index 3bea6f857c..8acbffdd7a 100644 --- a/documentation/datamodel/datamodel-forms.asciidoc +++ b/documentation/datamodel/datamodel-forms.asciidoc @@ -205,15 +205,13 @@ PopupDateField departing = new PopupDateField("Departing"); PopupDateField returning = new PopupDateField("Returning"); // Store return date binding so we can revalidate it later -FieldBinding<Trip, LocalDate> returnBinding = binder - .forField(returning) - .withValidator( - returnDate -> !returnDate.isBefore(departing.getValue()), - "Cannot return before departing") - .bind(Trip::getReturnDate, Trip::setReturnDate); +Binding<Trip, Date, Date> returnBinding = binder.forField(returning) + .withValidator(returnDate -> !returnDate.before(departing.getValue()), + "Cannot return before departing"); +returnBinding.bind(Trip::getReturnDate, Trip::setReturnDate); // Revalidate return date when departure date changes -departing.onChange(newValue -> returnBinding.validate()); +departing.addValueChangeListener(event -> returnBinding.validate()); ---- == Converting User Input |