Add or remove defined instances to a form


With _instance you can define a part of a form as an instance that can be added or removed by the user (in a way add more rows to submit more information).

How it works

_instance holds a list of parameters that define the usage of the instance.

First you define what template on a page it needs to edit (template-parent) and what parameter of that template needs to be edited (name).

The idea is that the name attribute will hold multiple templates. That template is defined with the template parameter.

If you leave out anything else, FlexForm will render the instance based on the default Wikibase Solutions setup. (default settings listed with the parameters).

All the other parameters are described below.



Main template to edit on a page


Name of the parameter to edit with the template-parent. Fields inside the instance cannot have the same name as this parameter.


Name of the template to put inside parameter name.


Allows to fill the instanced textarea with default content. Note: When a page contains text default content will always be overwritten.


Main class for the button add instance. This is a class name that triggers the add instance. default WSmultipleTemplateAddAbove You can set this to none to not add this option at all


Extra class that can be added to the button for styling default wsform-instance-add-btn If you want no extra class then use button-add-extra="none"


Main class for the button remove instance. This is the class name that triggers the remove instance.

default WSmultipleTemplateDel

You can set this to none to not add this option at all


Extra class that can be added to the button for styling

default wsform-instance-remove-btn

If you want no extra class then use button-remove-extra="none"


Main class for the move instance button. This is the class name that trigger a move instance.

default ws-sortable-handles

You can set this to none to not add this option at all


Extra class that can be add to the button for styling

default wsform-instance-move-handle

If you want no extra class then use button-move-extra="none"


Button below instance to add an add button. Value is text in the button

Use a value of "none" to disable this button

default empty


Class for the button below the instance. Defaults to WSmultipleTemplateAddAbove


div wrapper for the defined instance.

default WSmultipleTemplateMain


main div wrapper for all instances

default WSmultipleTemplateMain


Extra class to add styling to the instances.

default wsform-instance-record


class for the textarea to store instance information

default WSmultipleTemplateField


Class name for the wrapper for the list of instances

default WSmultipleTemplateList


<_form action="addToWiki">
	<_edit target="{{PAGEID}}" template="Log" formfield="Hours spent today" />
		template="Hours spent" 
		name="Hours spent today" 
		<div class="test">
			<_input type="text" name="Task" placeholder="Task" />
	<_input type="submit" />


Using instances default content together with Tokens and a SMW query

When using this combination, usually the value of a token has been saved and is put inside the default content. When rendering the instances, FlexForm will try to do a query to look-up the label that is attached to the value of the token.

Example : Say the Token-field is used to find certain pages with certain Semantic properties. In most cases the token visually shows the Display title of a query while the value of the token is the exact page Title and that is also the value that will be stored.

When rendering instances with previous saved page titles, FlexForm Tokens does not have the appropriate label to show for the token, in this case the Displaytitle. FlexForm will then analyze the SMW query attached to the token and try to get the SMW property as a label. In this case, the Displaytitle.


Tutorial on Instances :