Hi guys,
I have this custom template that is a slightly modified version of the one in the repo, however it does not seem to be recognized by autoform.
{{#autoForm collection="Programmes" id="insertProgrammeForm" type="insert" template="plain"}}
{{> afQuickField name="name"}}
{{> afQuickField name="description" rows=6}}
{{> afQuickField name="author"}}
{{> afQuickField name="exercises" template="myTemplate"}}
{{> afQuickField name="createdAt" type="hidden" template="myTemplate"}}
<button type="submit">Create programme</button>
{{/autoForm}}
As you can see from the above I tried to set the template directly on my quickfield with the name of exercises.
<template name="myTemplate">
<legend>Testing if it works!</legend>
{{#if afFieldIsInvalid name=this.atts.name}}
<div class="autoform-array-field-error">
{{{afFieldMessage name=this.atts.name}}}
</div>
{{/if}}
{{#afEachArrayItem name=this.atts.name minCount=this.atts.minCount maxCount=this.atts.maxCount}}
<div class="autoform-array-item">
{{> afQuickField name=this.name label=false}}
{{#if afArrayFieldHasMoreThanMinimum name=../atts.name minCount=../atts.minCount maxCount=../atts.maxCount}}
<button type="button" class="autoform-remove-item">Remove</button>
{{/if}}
</div>
{{/afEachArrayItem}}
{{#if afArrayFieldHasLessThanMaximum name=this.atts.name minCount=this.atts.minCount maxCount=this.atts.maxCount}}
<div style="margin-top: 20px;">
<button type="button" class="autoform-add-item" data-autoform-field="{{this.atts.name}}" data-autoform-minCount="{{this.atts.minCount}}" data-autoform-maxCount="{{this.atts.maxCount}}">Add</button>
</div>
{{/if}}
</template>
Is there anything special I have to do to make this work?
thanks in advance!