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

Distinguish between "simple" and "complex" forms #12

Open
arthurxavierx opened this issue Apr 17, 2019 · 2 comments
Open

Distinguish between "simple" and "complex" forms #12

arthurxavierx opened this issue Apr 17, 2019 · 2 comments
Labels
question Further information is requested

Comments

@arthurxavierx
Copy link
Contributor

Currently there is no way of restricting the type of forms allowed inside certain compound FormBuilders (e.g. indent, array, editableTable see #1).

It would be interesting to not allow indented forms inside some specific form builders.

@hdgarrood
Copy link
Contributor

I don't think we want to restrict the types of forms inside indent or array, since we are nesting these in our specs forms currently (and it seems like it works fine and that they were intended to work that way, even).

Were you imagining restricting the types just to avoid making forms which look messy when rendered, or restricting types in order to ensure that the resulting editable table actually functions correctly? I'm not sure I'm a huge fan of restricting the forms in editableTable components either; I think the FormBuilder type probably has enough type parameters as-is, so if it's just to help avoid messy-looking forms I'm not sure I'd consider the type system to be appropriate for that.

@paf31 paf31 added the question Further information is requested label Apr 19, 2019
@paf31
Copy link

paf31 commented Apr 19, 2019

@hdgarrood You might be right, because we can't stop users from wrapping any old component in a form and putting it into an editable table.

I'm more bothered by the flattening of Forest in EditableTable. It indicates to me that we should be able to generalize forms over the structure used to represent their nesting. The same thing also shows up in the validation API - adding a validator to a nested form requires us to walk down the tree to look for a leaf to attach the message to - but I think the better solution is to disallow validators on nested forms.

So we can't stop users from wrapping arbitrary rubbish in a FormBuilder and calling it primitive, but we can at least prevent misuse if you stick to the primitives we provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants