diff options
author | Tatu Lund <tatu@vaadin.com> | 2019-12-20 12:47:24 +0200 |
---|---|---|
committer | Anna Koskinen <Ansku@users.noreply.github.com> | 2019-12-20 12:47:24 +0200 |
commit | 7f733bc2aab41963a9ef44be252f3ee2462fa70a (patch) | |
tree | 23301a4d433f686058cddae2f93d4e9b75a3b386 | |
parent | 685e4487932f53890057d1e9a69f3d2e484eb0bd (diff) | |
download | vaadin-framework-7f733bc2aab41963a9ef44be252f3ee2462fa70a.tar.gz vaadin-framework-7f733bc2aab41963a9ef44be252f3ee2462fa70a.zip |
Added documentation of newly added Binder features (#11845)
-rw-r--r-- | documentation/datamodel/datamodel-forms.asciidoc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/documentation/datamodel/datamodel-forms.asciidoc b/documentation/datamodel/datamodel-forms.asciidoc index fc4572f97c..0061304c68 100644 --- a/documentation/datamodel/datamodel-forms.asciidoc +++ b/documentation/datamodel/datamodel-forms.asciidoc @@ -138,6 +138,7 @@ binder.forField(nameField) binder.forField(titleField) // Shorthand for requiring the field to be non-empty + // This is conditional on Binding::setAsRequiredEnabled(boolean) .asRequired("Every employee must have a title") .bind(Person::getTitle, Person::setTitle); ---- @@ -382,6 +383,11 @@ if (saved) { ---- -- +[NOTE] +Note, if you need to write the values passing the validation regardless of having one or more failing validators, you can +use binder.writeBeanAsDraft(person). + + Binder keeps track of which bindings have been updated by the user and which bindings are in an invalid state. It also fires an event when this status changes. We can use that event to make the save and reset buttons of our forms become enabled or disabled depending on the current status of the form. @@ -612,3 +618,10 @@ binder.forField(yearOfBirth) binder.bindInstanceFields(this); ---- + +[NOTE] +If you need to bind nested proprerties with bindInstanceFields method, you need to instantiate the Binder using: +[source,java] +---- +Binder<Person> binder = new Binder<>(Person.class,true); +---- |