Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/components/renderer/form-loop.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<template>
<div class="form-group">
<div v-for="loopIndex in times" :key="loopIndex">
<vue-form-renderer
@submit="submit"
:data="getMatrixValue(loopIndex)"
@update="setMatrixValue(loopIndex, $event)"
:config="rendererConfig"
:computed="null"
:custom-css="null"
:watchers="null"
<form>
<vue-form-renderer
@submit="submit"
:data="getMatrixValue(loopIndex)"
@update="setMatrixValue(loopIndex, $event)"
:config="rendererConfig"
:computed="null"
:custom-css="null"
:watchers="null"
/>
</form>
</div>
</div>
</template>
Expand All @@ -36,6 +38,12 @@ export default {
}];
},
times() {
// If there is existing data, set the length to what ever it is
const itemsFromData = _.get(this.transientData, this.name, null);
if (Array.isArray(itemsFromData)) {
return [...itemsFromData.keys()];
}

if (!this.config) {
return [];
}
Expand Down
4 changes: 2 additions & 2 deletions src/form-builder-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ export default [
type: 'FormInput',
field: 'times',
config: {
label: 'Number of times',
helper: 'Enter the number of times to repeat the element(s)',
label: 'Default Number Of Times',
helper: 'Enter the number of times to repeat if the data does not exist.',
},
},
],
Expand Down