-
Notifications
You must be signed in to change notification settings - Fork 34
Conversation
use it for fields and errors, and implement remaining features in error handling for lists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, I will review.
@@ -65,7 +61,11 @@ textArea : Input e String | |||
textArea state attrs = | |||
let | |||
formAttrs = | |||
<<<<<<< HEAD | |||
[ defaultValue (state.value ?= "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, not sure how that went through tests :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor things that I saw. Honestly, I didn't completely get how the new Tree worked, but it seems to be working wonderfully :)
[ class "row link" ] | ||
[ col' 3 [ text "Link" ] | ||
, Input.textInput | ||
(Form.getFieldAsString ("links." ++ (toString i) ++ ".name") form) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\_ -> | ||
let | ||
( name, value ) = | ||
( "links.0.name", "Twitter" ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering, what happens is the path is wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when wrongly indexed, the input will be ignored. it was adding too much complexity to deal with holes in a list :)
* flipped `andThen` * `apply` flipped and renamed to `andMap` * renamed: * `formN` to `mapN` * `get` to `field` * `formatError` to `mapError` * dissociated input types (`Form.InputType`) and input values (`Field.FieldValue`) so now `Field` API follows `Json.Encode` * means `Msg(Input)` and `Form.Input` helpers changed * tuples builders for initial fields moved to `Form.Init` module * misc 0.18 fixes
This PR implements support for dynamic list of fields, as requested in #50
This required a more powerful tree structure so its representation and handling have been extracted to a dedicated module. A few things have changed in the API, that will be a major release.
Field.Field
andError.Error
have been renamed toField.FieldValue
andError.ErrorValue
Field
andError
are now just trees of values and can be handled byTree
module if needed.Error.value
Field
module are now producing tuplesAppend
andRemove
messagessomeGroup.0.someField
/cc @amitaibu @DavidHernandez