1

My schema has a field which is an unlimited array of textfields. I want to do exactly what the example here at the end shows: http://redux-form.com/6.5.0/docs/api/FieldArray.md

const renderSubFields = (member, index, fields) => (
    <li key={index}>
      <button
        type="button"
        title="Remove Member"
        onClick={() => fields.remove(index)}/>
      <h4>Member #{index + 1}</h4>
      <Field
        name={`${member}.firstName`}
        type="text"
        component={renderField}
        label="First Name"/>
      <Field
        name={`${member}.lastName`}
        type="text"
        component={renderField}
        label="Last Name"/>
    </li>
)
const renderMembers = ({ fields }) => (
  <ul>
    <button type="button" onClick={() => fields.push({})}>Add Member</button>
    {fields.map(renderSubFields)}
  </ul>
)

I imagine this is a fairly common thing to do but I don't see anything like this in the AOR docs or demo. Are there any examples that I'm missing?

1 Answer 1

1

I think you meant EmbeddedManyInput that desribed in https://github.com/marmelab/admin-on-rest/issues/695

Sign up to request clarification or add additional context in comments.

1 Comment

That's it! Thanks. Until it makes it into core, I'll try out the PR code. github.com/marmelab/admin-on-rest/pull/697/files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.