Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Forms in 0.3 didn't support a "Known to be Valid" state, which is required for my app. This design is common in signup forms, when you confirm that a username is available, and the field turns green.
This branch expands the
Validated
options into the following. It also supports type-based indexing on the Validation type, using type-level lists. So forms now know which fields they contain, based on that type-level list, and the Validation must match. See Example.FormsI also changed the
Mod
forfield
to(Validated fs a -> Mod)
, which makes it easy to customize the style for the entire field at once based on the state. It makes it slightly less easy to set default styles on the field, but those can also be set on a nested container or the input itself. Accessing theValidated fs a
for the field otherwise requires callingfieldValid
.@kfigiela Have you played with forms yet? I'd love some feedback: I'm unsure about the design. It supports many use-cases, but I wish that the validation states were customizable / composable (not easy to do without complicating the types significantly).