When I create a new field and set the widget to Term reference autocomplete, all works fine.
If I grab an existing field and change the widget type of it, I get JS error on the edit form:
Uncaught TypeError: Cannot call method 'indexOf' of undefined term_ref_autocomplete.js?v=1.0.0:109
This is because the widget tries to get the data from the old autocomplete URL: taxonomy/autocomplete
If I read the field instance info, the autocomplete_path is obviously wrong:

field_info_instance("node", "field_ship_tags", "ship");
    [widget] => Array
        (
            [active] => 0
            [module] => term_ref_autocomplete
            [settings] => Array
                (
                    [autocomplete_path] => taxonomy/autocomplete
                    [size] => 60
                )

            [type] => term_ref_autocomplete_widget
            [weight] => 24
        )

The expected behavior would be to change the autocomplete path on widget change too.
So the [autocomplete_path] needs to be 'term_ref_autocomplete/autocomplete'

Thanks, and keep the good work, this is a really nice and needed module!

Comments

kardave’s picture

I ran this for all my existing fields.

 // Fetch an instance info array.
  $instance_info = field_info_instance("node", "field_my_tags", "my_content_type");
  // Change a single property in the instance definition.
  $instance_info['widget']['settings']['autocomplete_path'] = "term_ref_autocomplete/autocomplete";
  // Write the changed definition back.
field_update_instance($instance_info);

UPDATE:
Changing back to usual autocomplete neither change the autocomplete_path...

arpieb’s picture

Assigned: Unassigned » arpieb
Status: Active » Fixed
StatusFileSize
new1.1 KB

It looks like the stock autocomplete widget's AJAX endpoint is getting picked up since it uses the same option name as this module's widget. Since there wound up being no editable setting, I have hardcoded the path into the widget instead of it being a widget setting. Most likely this is cruft from early dev work...

Patch attached that applies against alpha2 fine, also updated in the 7.x-1.x dev branch on commit 42e10e6.

Thanks for catching this and reporting it!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

arpieb’s picture

Issue summary: View changes

Deployed on release 1.0-alpha3. Thanks for the contributions!