Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a way for marking fields as required to the TypeScript Binder API #8551

Closed
vlukashov opened this issue Jun 11, 2020 · 0 comments · Fixed by #8598
Closed

add a way for marking fields as required to the TypeScript Binder API #8551

vlukashov opened this issue Jun 11, 2020 · 0 comments · Fixed by #8598
Assignees
Labels
DX hilla Issues related to Hilla

Comments

@vlukashov
Copy link

It should be clear how to mark a field as required when defining custom field validators in TypeScript.

DoD:

  • the Validator<T> type in TypeScript has an (optional) impliesRequired_name_pending property so that user-defined custom validators have an way to indicate that the field should be marked as 'required'.
  • both Validators in TypeScript and Using JSR 380 Bean Validation docs pages include a paragraph / section showing an example of how to mark a field as required
  • the existing out-of-the-box client-side validators that are currently hard-coded to mark a field as required are updated to use the new property (Max, Min, Size, etc)
@vlukashov vlukashov added hilla Issues related to Hilla DX labels Jun 11, 2020
@platosha platosha self-assigned this Jun 18, 2020
platosha added a commit that referenced this issue Jun 24, 2020
* Add impliesRequired flag to client-side Validator interface

Fixes #8551

* Update flow-client/src/main/resources/META-INF/resources/frontend/form/BinderNode.ts

Co-authored-by: Kari Söderholm <haprog@vaadin.com>

Co-authored-by: Kari Söderholm <haprog@vaadin.com>
vlukashov pushed a commit to vaadin/flow-and-components-documentation that referenced this issue Jun 29, 2020
Highlight server-side validation as the primary way to validate the user input.
Present client-side validation as a UX optimization.
Provide a complete example for adding a custom validator (both server-side and client-side).
Introduce JSR-380 instead of assuming readers know what it is.
Make the example more realistic.

Also update the docs after fixing vaadin/flow#8551 and vaadin/flow#8552

Fixes #1291
Fixes #1292
platosha added a commit to vaadin/flow-and-components-documentation that referenced this issue Jun 30, 2020
* fix: improve client-side validation docs

Highlight server-side validation as the primary way to validate the user input.
Present client-side validation as a UX optimization.
Provide a complete example for adding a custom validator (both server-side and client-side).
Introduce JSR-380 instead of assuming readers know what it is.
Make the example more realistic.

Also update the docs after fixing vaadin/flow#8551 and vaadin/flow#8552

Fixes #1291
Fixes #1292

* reveiew comments

 - move the 'note' block from the beginning to the point when custom client-side validators are introduced
 - move the 'required field' section to under the custom validators section

Co-authored-by: Anton Platonov <anton@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX hilla Issues related to Hilla
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants