Changing variant of array item by code


Type A: Convert
Type B: Convert
Add "A" Add "B"
<div data-array="Items" data-remove="1" data-placeholder="No items, click add below!">
    <div class="a alert alert-info" data-variant="A">
        Type A: <span class="btn converta btn-xs btn-default">Convert</span>
        <input name="Title" placeholder="Enter title"/>
    </div>
    <div class="b alert alert-success" data-variant="B">
        Type B: <span class="btn convertb btn-xs btn-default">Convert</span>
        <input name="Title" placeholder="Enter title"/>
    </div>
</div>
<a class="btn btn-info" data-action="add" data-variant="A" data-target="Items">Add &quot;A&quot;</a>
<a class="btn btn-success" data-action="add" data-variant="B" data-target="Items">Add &quot;B&quot;</a>
function AttachDocEvents($e) {
$e.find(".converta").on("click", function() { $form.ChangeVariant($e, "B"); });
$e.find(".convertb").on("click", function() { $form.ChangeVariant($e, "A"); });
}

Output templates

Templates used for document and web page generation:

Friendly Name File Name Template