Skip to main content

Archetypes autocomplete widget with support for String-, Lines- and ReferenceFields

Project description

Overview

To use this package just create a field like:

StringField('test_field',
        default='',
        searchable=0,
        required=0,
        vocabulary=DisplayList((('week', 'Week'), ('wedding','Wedding'),
                            ('winona','Winona'), ('winter', 'Winter'),
                            ('weather','Weather'), ('cow', 'Cow'))),
        widget=AutocompleteWidget(label='Test Widget',
                            description='Test this',
                            ),
        enforceVocabulary=0,
        ),

You can also use a LinesField instead of a StringField. The widget adapts automatically. This has the advantage that you can index the field in the catalog (keyword index). Combine this with the filter_bogus property on the widget and the widget will prepare the entered values.

It’s useless without a vocabulary, and setting enforceVocabulary true doesn’t really make sense unless you use the LinesField.

Configuration

There are a few parameters that can be set to alter the behavior of the widget:

actb_timeout:

How long (ms) before the autocomplete box times out and dissapears. (Default: 2500, -1 to disable)

actb_lim:

How many choices to show in the autocomplete box at a time. (default: 5)

actb_firsttext:

Should the autocomplete serach be limited to the beginning of keyword (True), or should it search the entire entry for a match (False)? (default: 0)

actb_filter_bogus:

Remove keywords that are not in the vocabulary and also remove redundant keywords, leading/trailing spaces etc.

actb_expand_onfocus:

Expand the dropdown on focus.

actb_complete_on_tab:

Set to 0 if you want tab to move the focus to the next widget. default is 1.

Credits

The javascript used is based on the widget at http://codeproject.com/jscript/jsactb.asp by zichun and used with permission.

The improved_multivalued_fields_management branch which has become the new trunk of this package was started by Quadra Informatique <plone at quadra-informatique dot fr>.

Thanks to all contributors (names listed in Changes).

Changes

1.5.0 (2016-03-21)

  • Use png icons instead of gif ones (Plone 4.3 compatibility). [thomasdesvenain]

  • We can set as false a parameter on widget: actb_multivalued_adding_is_required, so that if user hasn’t clicked ‘add’ button on a multivalued field, current input is considered as a new value. Improves user experience when vocabulary is not enforced. [thomasdesvenain]

  • Added a property in site_properties to define custom separators. “,” is set as a custom separator by default. “;” is always a separator. [thomasdesvenain]

  • Fixed: was unusable out of the box with default sunburst theme. [thomasdesvenain]

  • Consider, by default, lines fields as multiValued fields. [thomasdesvenain]

1.4.0 (2011-10-24)

  • Merged from trunk, keeping fixes and features [Quadra Informatique - jriboux]

From 1.0 original trunk

  • Fixed safari keyboard issues. Added single select option [dannyb]

  • Updated to use a GenericSetup profile for installation [wichert]

  • Change the templates to use a div based dropdown, giving a sane scrolling experience. [dannyb]

1.3 (15-03-2010)

  • Added possibility to hide the clear button

  • Corrected a bug showing () when the multivalued field was empty

  • Added compatibility with reference fields

  • generalized a few checks to make compatible with ReferenceFields (davisagli)

  • inline the filter function and uses scopes instead of method calling. the vocab for field was being called for each term stored in the field keyword_from_value method should go away. It’s no longer being used. also general white space cleanups. (runyaga)

  • tabindex is not available for archetypes widgets anymore and broke edit views in plone4 - fixes http://plone.org/products/autocompletewidget/issues/5 (fRiSI)

  • eggified product (fRiSi)

    • history.txt and HISTORY.txt merged to CHANGES.txt

    • added issue #3 (merging with trunk) to todo.txt

    • removed refres.txt since it’s no longer supported

  • made widget work with vocabularies containing non-ascii characters too (fRiSi)

2008-03-14 - v1.2.1 : Quadra Informatique - Jonathan Riboux

  • integrated Ak Sorpa’s fix to prevent &amp;, &lt; and &gt; to appear in the input box after selecting a value in the drop-down list

2008-03-12 - v1.2 : Quadra Informatique - Jonathan Riboux

  • corrected i18n attributes so AutocompleteWidget can be used in English

  • added tooltips and button labels

  • better look

  • added CSS classes to buttons

2008-02-25 - v1.1 : Quadra Informatique - Nicolas Geissel

  • using fieldName var instead of field.getName for better flexibility (widget can now be used as a search widget)

  • added i18n

2008-02-07 - v1.0 : Quadra Informatique - Jonathan Riboux

  • improvement of display list support (display value, but register key)

  • widget shows a list of current values next to the input field for multivalued fields

  • arrows navigation in menu now works on Internet Explorer

  • cleanup of process_form code

2005-02-09: Danny Bloemendaal

  • ESC shows the dropdown list

  • onblur now works and hides the list

  • added property to have the list expanded on focus

  • renamed filter_bogus to actb_filter_bogus to have a consistent naming

2005-02-08: Danny Bloemendaal

  • replaced the javascript factory with the latets version from the original author

  • redid the styling so the widget resembles more the standard widget formatting

  • removed some configuration stuff that only lead to bad UI behavior

  • added LinesField support so the field can now be indexed properly

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Products.AutocompleteWidget-1.5.0.tar.gz (18.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page