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 component that renders a list of fields #31

Closed
macrozone opened this issue Jun 16, 2016 · 5 comments
Closed

Add a component that renders a list of fields #31

macrozone opened this issue Jun 16, 2016 · 5 comments
Assignees
Labels
Type: Feature New features and feature requests

Comments

@macrozone
Copy link
Contributor

I think it would be nice to have a <AutoFieldList />-component that renders a list of fields automatically
similar to aldeed:autoform's https://github.com/aldeed/meteor-autoform#afquickfields:

<AutoForm>
  <AutoFieldList />
  <SubmitField value="send" />
</AutoForm>

This allows us to easly change the style or behavior of the submit button or to add more elements inside the form without loosing the "auto-form-magic".

you could also omit fields:

<AutoForm>
  <AutoFieldList omitFields={["userId", "title"]}/>
  <SubmitField value="send" />
</AutoForm>

or include only some fields:

<AutoForm>
  <AutoFieldList fields={["title", "text"]}/>
  <SubmitField value="send" />
</AutoForm>

or group some fields:

<AutoForm>
  <div class="col-xs-6">
      <AutoFieldList fields={["title", "text"]}/>
  </div>
  <img class="col-xs-6" src="funnycatpicture.jpg" />
  <div class="col-xs-12">
      <AutoFieldList fields={["comment"]}/>
  </div>
  <SubmitField value="send" />
</AutoForm>

What do you think?

Should be easy to develop, right? AutoFieldList (or however it will be named) could receive the schema-definition by context.

@radekmie
Copy link
Contributor

Great idea, @macrozone!

How about AutoFields? AutoFieldList might be confused with ListField (and it's family). In spite of all, that's a great idea! I'll do it later today.

@radekmie radekmie added the Type: Feature New features and feature requests label Jun 16, 2016
@radekmie radekmie self-assigned this Jun 16, 2016
@macrozone
Copy link
Contributor Author

macrozone commented Jun 16, 2016

Also thought about AutoFields, but it may be get confused with AutoField ;-)

But on second thought, it seems logical to name it AutoFields

@radekmie
Copy link
Contributor

Check it out. I'll publish new version later. Let me know, if there are some errors.

@vladejs
Copy link

vladejs commented Aug 16, 2016

It doesn't work for me:

<AutoForm
                schema={ ProductSchema }
                onSubmit={this.onSubmit.bind(this)}
                grid={2} inlineErrors
                model={this.props.model}
                submitField={this.getCustomSubmit.bind(this)}
            >
                <AutoFields />
            </AutoForm>

The error is:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `_class`

I'am using 1.0-rc30

@radekmie
Copy link
Contributor

Well... It turned out, that AutoFields component is not exported... Shame. I'll fix it ASAP.

@radekmie radekmie reopened this Aug 16, 2016
@radekmie radekmie moved this to Closed in Open Source Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features and feature requests
Projects
Archived in project
Development

No branches or pull requests

3 participants