Template:Multiple template formfields
From cm2.liecourt.com
This is the Multiple template formfields template. It should be called in the following format:
{{Multiple template formfields |Parameter name= <text> name of the multiple template parameter |Parameter value= <text> value of the multiple template parameter |Template= the name of the template of which there are multiple instances in Parameter |Class= class that is added around each instance |ID=<unique ID> |Instance=... wsfields need to have name format like this:"WS multiple template[<Parameter name>]" i.e. "WS multiple template[Description]" |Hide= OPTIONAL: if Hide==No, hidden fields are shown (can be useful for testing) |Sortable= OPTIONAL: if Sortable==No, instances are not sortable by dragging Optional parameters for customizing buttons: |Add above button text= OPTIONAL text for the "Add above" button shown in each instance, default={{Fa|plus}} Add |Delete button text= OPTIONAL text for the "Delete" button shown in each instance, default={{Fa|times}} |Add button text= OPTIONAL text for the "Add" button shown below the instances, default={{Fa|plus fa-fw}} Add }}
Example:
Note:
- The submit button of your form needs to have the onclick function WSmultipleTemplateSaveAll(), like in the example below.
- All fields within the instance must have names with the format "WS multiple template[<Parameter name>]"
<wsform> {{Multiple template formfields |Parameter name=Variables |Parameter value=< nowiki>{{Document vardefine |ID=1 |Name=Supplier |Value=Wikibase Solutions }}{{Document vardefine |ID=2 |Name=Customer |Value=Westenburg assurantien }}</ nowiki> |Template=Document vardefine |ID=multipleTemplate324 |Instance=<div class="mb-3">{{Item responsive |1='''Name:''' |2={{#tag:wsfield||type=text |name=WS multiple template[Name] }} }}<!-- -->{{Item responsive |1='''Value:''' |2={{#tag:wsfield||type=text |name=WS multiple template[Value] }} }}<!-- -->{{Item responsive |1='''ID:''' |2={{#tag:wsfield||type=number |name=WS multiple template[ID] }} }}<!-- -->{{Item responsive |1='''Test:''' |2={{#tag:wsfield||type=checkbox |name=WS multiple template[Test] |value=true }} Testing with checkbox }}<!-- --></div> }} <wsfield type="submit" class="btn btn-primary" value="Opslaan" onclick="WSmultipleTemplateSaveAll()" /> </wsform>