You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Formless does not provide a type that can be used in the row of fields to indicate that the row is a collection of fields. To workaround this limitation, one can use a nested form based on the example in this repo.
However, the above example is not as "real world" as it could be in the following ways:
the "Submit All" button is clickable regardless of whether a member form has been added or not. I had to write my own queries to deal with this issue.
The form's submission can contain an empty array of member data. That works for that example, but in my example, all entities fields are required. To implement that logic, I need to use Halogen queries that must return a Maybe (Array entity) rather than an Array entity.
Here's my use case. I have a form with a dynamic array of entities that need to be submitted. On one run, there might only be one entity. In another, it might be as many as 6. Each entity has two fields. The submit button should only be clickable when all of the entities' 2 fields are valid. When the submit button is clicked, it should raise a Array entity, not a Maybe (Array entity).
Expected behavior
The developer can use a custom Formless-provided type that indicates that a given row is a collection of fields.
I'm not sure how the above could be supported. While collection could be Identity in normal situations and Array/List/Maybe in other situations, the definition also allows a weird sort of case (e.g. Map someKey) that might not make sense.
Example Code
Note: I haven't actually run this code to verify whether it works as intended. I do know that it compiles.
If you need a field which is itself an array of fields, then the field (as far as Formless is concerned) will be coordinating among several fields (as far as the browser / UI events are concerned). Your best bet is to render the browser fields so each one tracks its index in the array and updates its value there appropriately.
Environment
purescript-halogen
v5.0.0-rc.7purescript-halogen-formless
v1.0.0-rc.1Current behavior
Formless does not provide a type that can be used in the row of fields to indicate that the row is a collection of fields. To workaround this limitation, one can use a nested form based on the example in this repo.
However, the above example is not as "real world" as it could be in the following ways:
Maybe (Array entity)
rather than anArray entity
.Here's my use case. I have a form with a dynamic array of entities that need to be submitted. On one run, there might only be one entity. In another, it might be as many as 6. Each entity has two fields. The submit button should only be clickable when all of the entities' 2 fields are valid. When the submit button is clicked, it should raise a
Array entity
, not aMaybe (Array entity)
.Expected behavior
The developer can use a custom Formless-provided type that indicates that a given row is a collection of fields.
I'm not sure how the above could be supported. While
collection
could beIdentity
in normal situations andArray
/List
/Maybe
in other situations, the definition also allows a weird sort of case (e.g.Map someKey
) that might not make sense.Example Code
Note: I haven't actually run this code to verify whether it works as intended. I do know that it compiles.
The text was updated successfully, but these errors were encountered: