ItemComparisonForm

ItemComparisonForm provides a customizable form to select items and then load a template using those items as parameters.
== ==
== ==
=== Creating a form ===
To create a form, add the item-comparison-form class to an element. The form's type is specified using the data-form-type attribute. At the moment only data-form-type="duplicate" is supported. The minimum and maximum number of fields is specified using the data-min-fields attribute and data-max-fields attribute. At the moment only the minimum number of fields is used, because the ability to add or remove fields after loading has not been implemented.
In the form, there can be multiple fields specified, and with the duplicate form type, the last field is duplicated until the minimum number of fields is reached by adding duplicates after the last field. Each field uses a customizable options menu.
To create a field, add the item-comparison-form__field class to an element in the form. The field's menu template is specified using the data-template attribute and static parameters can be specified with a JSON object string in the data-static attribute. A label and/or an element with the item-comparison-form__field-input class can be added inside the form field element. The field input element will act as a button to toggle the field menu and will also contain the display text for the option that was chosen. A default option can be added using the data-value attribute, and the default option's display text can be added inside the field input element.
In the menu template, elements that can be clicked as options should have the item-comparison-option class added to them. The value that will be passed into the content template is specified using the data-value attribute, and the display text that will be shown in the field input element is specified using the data-text attribute.
In the form, there should be a submit button that will load content into the content container. A submit button can be specified by adding the item-comparison-submit class to an element in the the form. The submit button's content template is specified using the data-template attribute and static parameters can be specified with a JSON object string in the data-static attribute.
A content container can be specified by giving an element an id that corresponds with the id of the form. For example, if the form has an id of weapon-comparison then the content container should have an id of weapon-comparison-content-container.
=== ===
Form:
Field menu:
* Pulsar VS1
* Equinox VE2
* Equinox VE2 Burst
* H-V45
* CME
* Terminus VX-9
* Corvus VA55
* VE-A Lacerta
* Darkstar
== Credit ==
Inspired by and used as references:
* Duel Masters Play Wiki's Advanced Card Search