Summary
Add new parameter property of 'Values,' which if used displays a combobox to users in VE with these values instead an input field. This would allow a template creator/editor to set a list of inputs as the possible choices for a parameter in TemplateData, converting it into an ENUM type. This implementation without creating a new parameter type builds on the discussion from this ticket: T53375: TemplateData: Add parameter type for selecting one of predefined values (like "<select>" or ENUM).
This ticket has four parts, to be implemented on the test instance in order to use it for usability testing and understand any potential issues the proposed change may cause:
- Add new parameter property to TemplateData, "Values."
- Add this property to the TemplateData editor with a single field accepting comma separated values. Label "Limit values to (comma separated)." Note: in a later ticket, all fields will get descriptions describing the impact of their choices on VE and what users will see. This one will include, "When used a dropdown with these values will be displayed, when left empty users will see an input field."
- Add the combobox input type to the Visual Editor dialog to display parameters with this property. Use OOUI ComboBoxInputWidget (filtering on input).
- Add a warning when a value is entered that is not in the list of values.
Mock ups
TemplateData Editor
Visual Editor
Requirements
- Values field should only be shown for parameter types: Unknown, String, Line, and Number.
- User should be able to easily add a short or long list of values to the TemplateData in both the TemplateData editor and in JSON. If the list is long, it should wrap and be visible at a glance, not cut-off by the input field. The text field should expand to multi-line.
- The combobox must allow users to type to find an existing value from the dropdown or type in a value not existing in the dropdown.
- When a user types in a value not included in the dropdown, an in-line warning should display, "This template is intended to work with only the provided values. If the deviation from the list is intentional, it is still possible to publish." This warning should not block the user from saving if they still want to.
Open Questions
- Are there other parameter types which should display this new 'Values' property? What happens if someone gives a values property to another type in JSON?
- Is there a maximum number of values that can be added? Ideally this would allow for a very large number of values.
- Should the warning display immediately after typing (but not during or before) or after the user presses submit, requiring them to submit a second time to bypass it?
- Are there any benefits to the alternate way of implementing this - adding a new parameter type called "Dropdown," which then allows you to add values? This decreases the flexibility and increases the complexity from a TemplateData standpoint. On the other hand, it may be clearer to users which actions they need to take if they would like to create a dropdown for a particular parameter.
Alternate: