1 modules.repeat
Florian Bouillon edited this page 3 months ago

Repeat Input

repeat your fields !


<div class="fm-repeat" name="field_name">
    <div class="fmr-template example-class">
        <input data-input data-name="name" type="text"/>
        <!-- if there is only one input the result will be an array of values -->
        <!-- if there is only multiple inputs the result will be a named array of results -->
        <div class="fmr-del">
    <div class="example-class fmr-element">
        <input data-input data-name="name" type="text"/>
        <button class="fmr-del"></button>
    <!-- future elements will always be placed before `.fmr-add` -->
    <button class="fmr-add"></button>


This is a big one !

  • a container div/span/whateveryouwant containing a class .fm-repeat and a name attribute this is the name that will be submitted
    all elements have are to be contained in the .fm-repeat

  • a .fmr-template element that will contain you inputs

  • in the .fmr-template your inputs MUST have a data-name attribute and a data-input attribute
    the data-name can be empty if there is only one input in the template

  • always in the .fmr-template a .fmr-del that will have a listenere attached to delete the future lines of inputs

  • a .fmr-add that will have a listener attached to it to add future lines of inputs