wires up frontend for repeater, need to handle backend
This commit is contained in:
@@ -10,6 +10,14 @@ class Repeater extends Component {
|
||||
return (
|
||||
<div className="field-repeater">
|
||||
<Section heading={this.props.label}>
|
||||
{this.props.initialValue.map((item, i) =>
|
||||
React.Children.map(this.props.children, child =>
|
||||
React.cloneElement(child, {
|
||||
initialValue: item[child.props.name],
|
||||
name: `${this.props.name}[${i}]${child.props.name}`
|
||||
})
|
||||
)
|
||||
)}
|
||||
</Section>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -27,6 +27,7 @@ const fieldType = (PassedComponent, type, validate, errors) => {
|
||||
|
||||
componentDidMount() {
|
||||
let value = this.props.value ? this.props.value : '';
|
||||
value = this.props.initialValue ? this.props.initialValue : value;
|
||||
value = this.props.valueOverride ? this.props.valueOverride : value;
|
||||
this.sendField(value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user