How to programmatically add terms to field using Javascript?

Created on 13 June 2019, over 5 years ago
Updated 7 March 2023, over 1 year ago

Hey there,

is there a way to manually add terms to the field using, for instance, the console? I have a hard time accessing functions like addValue or any other way to add terms to the field.

Background: I have a list of all terms beneath the field, by clicking them I want the deluxe field to apply/ add that clicked term to the actual bar.

Thanks

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Multiple values

Created by

πŸ‡©πŸ‡ͺGermany sic

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mtovey

    Attaching a patch that changes the module js as @sic outlined earlier. This then allows subsequent js code with a reference to the HTML widget element to access the properties/methods from the MultipleWidget setup method. For example:

    let widgetObject = jQuery('#autocomplete-deluxe-input').data('autocomplete_deluxe_widget');
    let itemInit = {
    label: 'Create a new tag: #Sample tag',
    value: 'Sample tag',
    newTerm: true
    };
    widgetObject.addValue(itemInit);

Production build 0.71.5 2024