Name
_instance
Type
_instance
Synopsis
Add or remove defined instances to a form
Description
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, GlexForm will render the instance based on the default Wikibase Solutions setup. (default settings listed with the parameters).
All the other parameters are described below.
Parameters
template-parent
Main template to edit on a page
name
Name of the parameter to edit with the template-parent
template
Name of the template to put inside parameter name
default-content
Allows to fill the instanced textarea with default content. Note: When a page contains text default content will always be overwritten.
button-add
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
button-add-extra
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"
button-remove
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
button-remove-extra
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"
button-move
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
button-move-extra
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"
add-button-on-bottom
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
button-on-bottom-class
Class for the button below the instance. Defaults to WSmultipleTemplateAddAbove
wrapper-instance
div wrapper for the defined instance.
default WSmultipleTemplateMain
wrapper-main
main div wrapper for all instances
default WSmultipleTemplateMain
wrapper-main-extra
Extra class to add styling to the instances.
default wsform-instance-record
instance-storage
class for the textarea to store instance information
default WSmultipleTemplateField
instance-list
Class name for the wrapper for the list of instances
default WSmultipleTemplateList
Example
<_form action="addToWiki">
<_edit target="{{PAGEID}}" template="Log" formfield="Hours spent today" />
<_instance
template-parent="Log"
template="Hours spent"
name="Hours spent today"
>
<div class="test">
<_input type="text" name="Task" placeholder="Task" />
</div>
</_instance>
<_input type="submit" />
</_form>