Custom Repeater
Start of documentation contentUse of
Repeaters are a powerful feature of Formally that allow form authors to template and repeat templates of forms.
The onRepeater
handler is an SDK feature allows dynamic configuration of certain Repeater properties.
Use of onRepeater
<Formally
onRepeater={({ formValues, id, minRepeats, maxRepeats }) => {
if (id === 'repeater2') {
// synchronise repeater2 minRepeats with repeater1
const repeater1Values = formValues['repeater1'];
if (!Array.isArray(repeater1Values)) return;
return {
minRepeats: repeater1Values.length,
maxRepeats: repeater1Values.length,
};
}
}}
/>