EnhancedFormLayout
A from layout component with a FormItem that has functioning as required indication inherited from the wrapped component.
FormItem in the standard Vaadin FormLayout loses the required indicator of the field component. This component is and extended version of FormLayout with version of FormItem, EnhancedFormItem that solves this problem by inherting the required indicator of the wrapped component to the EnhancedFormItem itself.
See more: https://github.com/vaadin/vaadin-form-layout/issues/122
Fixed also issues with getResponsiveSteps().
See more: https://github.com/vaadin/vaadin-form-layout/issues/135
Adds methods to modify label aferwards.
EnhancedFormItem#setLabel(String)
EnhancedFormItem#setLabel(Component)
Adds following convenience API to configure the layout parameters more easily:
EnhancedFormLayout#setFormItemLabelWidth(String)
EnhancedFormLayout#setFormItemRowSpacing(String)
EnhancedFormLayout#setColSpacing(String)
EnhancedFormItem#setLabelWidth(String)
EnhancedFormItem#setRowSpacing(String)
EnhancedFormItem#setRightAlinged(boolean) - Make label right aligned
EnhancedFormItem#setBottomAligned(boolean) - Make the form item bottom aligned
Sponsored development
Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: Support and Pricing
Sample code
EnhancedFormLayout layoutWithBinder = new EnhancedFormLayout(); Binder<Contact> binder = new Binder<>(); // Create the fields TextField firstName = new TextField(); firstName.setValueChangeMode(ValueChangeMode.EAGER); TextField lastName = new TextField(); lastName.setValueChangeMode(ValueChangeMode.EAGER); TextField phone = new TextField(); phone.setValueChangeMode(ValueChangeMode.EAGER); TextField email = new TextField(); email.setValueChangeMode(ValueChangeMode.EAGER); DatePicker birthDate = new DatePicker(); Checkbox doNotCall = new Checkbox("Do not call"); Label infoLabel = new Label(); Button save = new Button("Save"); save.addThemeVariants(ButtonVariant.LUMO_PRIMARY); Button reset = new Button("Reset"); // Wrap with form items layoutWithBinder.addFormItem(firstName, "First name"); layoutWithBinder.addFormItem(lastName, "Last name"); layoutWithBinder.addFormItem(birthDate, "Birthdate"); layoutWithBinder.addFormItem(email, "E-mail"); EnhancedFormItem phoneItem = layoutWithBinder.addFormItem(phone, "Fone"); phoneItem.setLabel(new Label("Phone")); phoneItem.add(doNotCall); // Add the binder code ...
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Version 1.6.0
- Added support for vertical orientation
- Released
- 2022-07-22
- Maturity
- BETA
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 14+
- Browser
- Firefox
- Opera
- Safari
- Google Chrome
- iOS Browser
- Android Browser
- Microsoft Edge
EnhancedFormLayout - Vaadin Add-on Directory
A from layout component with a FormItem that has functioning as required indication inherited from the wrapped component.EnhancedFormLayout version 1.0.0
### Version 1.0.0
- The first version with EnhancedFormItem
EnhancedFormLayout version 1.0.1
### Version 1.0.1
- Fixed issues with getResponsiveSteps() https://github.com/vaadin/vaadin-form-layout/issues/135
EnhancedFormLayout version 1.1.0
### Version 1.1.0
- Added EnhancedFormItem#setLabel methods
EnhancedFormLayout version 1.2.0
### Version 1.2.0
- Added convenience API's to set item label width, row spacing and layout column spacing
EnhancedFormLayout version 1.3.0
### 1.3.0
- Added convenience method to set labels of FormItems right aligned
EnhancedFormLayout version 1.4.0
### Version 1.4.0
- Added chaining support for EnhancedFormItem setters
- Added convenience API to set vertical aligment of the form item
EnhancedFormLayout version 1.5.0
### Version 1.5.0
- Add method to control stickyness of the required indicator. By default indicator disappears after value input, but this can be controlled now.
EnhancedFormLayout version 1.5.1
### Version 1.5.1
- Fix: Required indicator not set if the required property is set upfront.
EnhancedFormLayout version 1.6.0
### Version 1.6.0
- Added support for vertical orientation