I love the widget. Will you als provide it as a Views Filter handler?
My users not only want to use it in node edit forms, but also an exposed filters in views.

Comments

sepgil’s picture

Status: Active » Closed (won't fix)

Currently I don't have any plans to do something like that, since I'm currently working on getting a stable release. After that I'll probably will work on my other module...

johnv’s picture

OK, that would be the 'autocomplete for references' module...

dgastudio’s picture

Component: Code » Single values - allow new values

it was really easy

function custom_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'your_view_name') {
$form['field_symptoms_tid'] = array(
'#type' => 'autocomplete_deluxe',
'#autocomplete_deluxe_path' => url('autocomplete_deluxe/taxonomy/your_exposed_filter_field', array('absolute' => TRUE)),
'#multiple' => TRUE,
'#autocomplete_min_length' => 0,
'#autocomplete_multiple_delimiter' => ',',
);
};
}

maybe add it to documentation?

dgastudio’s picture

Component: Single values - allow new values » Code (miscellaneous)
Status: Closed (won't fix) » Needs review

changing status

henrijs.seso’s picture

Snippet from kervi works indeed, here is same snippet with some formatting.

/**
 * Implements hook_form_alter().
 * @see http://drupal.org/node/1079826 for more information on this code.
 */
function YOURMODULENAME_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'YOUVIEWMACHINENAME') {
    $form['category'] = array(
      '#type' => 'autocomplete_deluxe',
      '#autocomplete_deluxe_path' => url('autocomplete_deluxe/taxonomy/YOURFIELDMACHINENAME', array('absolute' => TRUE)),
      '#multiple' => TRUE,
      '#autocomplete_min_length' => 0,
      '#autocomplete_multiple_delimiter' => ',',
    );
  };
}

Note on YOURFIELDMACHINENAME - it has to be term reference field machine name in form of 'field_*'. Note on views setup - exposed filter settings should be set to autocomplete.

emptyvoid’s picture

Pretty nifty, couldn't we add a autocomplete_deluxe.views.inc that registers a filter display format as "Auto Complete Deluxe"?

autocomplete_deluxe.module
function autocomplete_deluxe_views_api()
This would register which version of views it is compliant with.

function autocomplete_deluxe_form_views_exposed_form_alter()
This would register the new filter over autocomplete fields where the user has selected the field use auto complete deluxe instead of the default auto complete.

autocomplete_deluxe.views.inc
function autocomplete_deluxe_views_data_alter()
This method would add the handler for processing the autocomplete string?

I'm a little fuzzy what and where the GUI elements should be placed either in the settings for each field or in the form settings section.

Thoughts?

MGParisi’s picture

Emptyvoid, can you release a Patch? I would test it!

emptyvoid’s picture

The only rub is, as I found out with a custom module is that in order for auto_deluxe to work for different entities you'd have to use sub-modules like references or entity_references to provide the autocomplete results. The autocomplete deluxe default behaviour is for taxonomy only (I could be wrong here).

So we'd need to provide multiple autocomplete paths based on the entity type

merilainen’s picture

I'm trying to use this with search_solr_autocomplete. I got the suggestions to work, because there is a path for the suggestions available. But changing the delimiter from ',' to '+' doesn't affect the URL, it still has %2C (comma).

Here is my stab at this:

<?php
function MYMODULE_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'VIEW_MACHINE_NAME') {
    //dpm($form);
    $form['search_api_views_fulltext'] = array(
      '#type' => 'autocomplete_deluxe',
      '#autocomplete_deluxe_path' => url('search_api_autocomplete/search_api_views_VIEW_MACHINE_NAME/', array('absolute' => TRUE)),
      '#multiple' => TRUE,
      '#autocomplete_min_length' => 0,
      '#autocomplete_multiple_delimiter' => '+',
    );
  };
}
?>
digitopo’s picture


Edit 2: Got it working... thanks a lot! (I just hand to specify the correct form names etc)

EDIT: Stupid... forgot to put <?php?> tags around code in the .module file... Error is gone but still don't get the autocomplete deluxe widget.

Disregard:
I'd really like to use this feature... but after following the steps in #5 I am getting AJAX errors. Autocomplete widget doesn't show up, then when I start to enter a value in the search field (which is a regular autocomplete for taxonomy terms) I get the error.

I'm using a view with ajax enabled and Better Exposed Filters.

Anyone have some advice on how to get this to work?

Where is this path coming from? #autocomplete_deluxe_path' => url('autocomplete_deluxe/taxonomy/YOURFIELDMACHINENAME', array('absolute' => TRUE)),

Here is the error I get:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /projects/drupal/?q=views/ajax
StatusText: parsererror
ResponseText: /**
* Implements hook_form_alter().
* @see http://drupal.org/node/1079826 for more information on this code.
*/
function views_autocomplete_deluxe_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'grid_masonry') {
$form['category'] = array(
'#type' => 'autocomplete_deluxe',
'#autocomplete_deluxe_path' => url('autocomplete_deluxe/taxonomy/field_lesson_tags', array('absolute' => TRUE)),
'#multiple' => TRUE,
'#autocomplete_min_length' => 0,
'#autocomplete_multiple_delimiter' => ',',
);
};
}
[{"command":"settings","settings":{"basePath":"\/projects\/drupal\/","pathPrefix":"","ajaxPageState":{"theme":"salty_schoalrs_alpha","theme_token":"nFoH6_LQaLBZAN3NWnsNy-0mhiBShgGSufoqjcOgKeE"},"overlay":{"paths":{"admin":"node\/*\/edit_content_type_tab\/*\nmedia\/*\/edit\nmedia\/*\/multiedit\nmedia\/*\/delete\nmedia\/browser\nmedia\/browser\/*\nnode\/*\/edit\nnode\/*\/delete\nnode\/*\/revisions\nnode\/*\/revisions\/*\/revert\nnode\/*\/revisions\/*\/delete\nnode\/add\nnode\/add\/*\noverlay\/dismiss-message\nnode\/*\/questions\nuser\/*\/shortcuts\nadmin\nadmin\/*\nbatch\ntaxonomy\/term\/*\/edit\nuser\/*\/cancel\nuser\/*\/edit\nuser\/*\/edit\/*\nnode\/*\/display\nuser\/*\/display\ntaxonomy\/term\/*\/display\ndevel\/*\nnode\/*\/devel\nnode\/*\/devel\/*\ncomment\/*\/devel\ncomment\/*\/devel\/*\nuser\/*\/devel\nuser\/*\/devel\/*\ntaxonomy\/term\/*\/devel\ntaxonomy\/term\/*\/devel\/*\nnode\/*\/revisions\/view\/*\/*","non_admin":"admin\/structure\/block\/demo\/*\nadmin\/reports\/status\/php"},"pathPrefixes":[],"ajaxCallback":"overlay-ajax"},"better_exposed_filters":{"bef_datepicker":false},"views":{"ajax_path":"\/projects\/drupal\/?q=views\/ajax","ajaxViews":{"views_dom_id:cf344dee6a717d0c2ccbccf85103380a":{"view_name":"lesson_list_dev_","view_display_id":"grid_masonry","view_args":"","view_path":"lessons\/masonry","view_base_path":"lessons\/masonry","view_dom_id":"cf344dee6a717d0c2ccbccf85103380a","pager_element":"0"}}}},"merge":true},{"command":"viewsScrollTop","selector":".view-dom-id-cf344dee6a717d0c2ccbccf85103380a"},{"command":"insert","method":"replaceWith","selector":".view-dom-id-cf344dee6a717d0c2ccbccf85103380a","data":"\u003Cdiv class=\u0022view view-lesson-list-dev- view-id-lesson_list_dev_ view-display-id-grid_masonry lessons-list lessons-list-grid view-dom-id-cf344dee6a717d0c2ccbccf85103380a\u0022\u003E\n        \n  \n  \n  \n  \n  \n  \n  \n  \n\u003C\/div\u003E","settings":null}]
junetellain626’s picture

I got the code working from #3. The problem now is using my taxonomy exposed filter, it tries to create new terms when what I type does not exist in my vocabulary list (which is somehow an autocomplete deluxe feature by default). What code do i need to add in #3 to deny the creation of new terms ?

sepgil’s picture

If someone implements this feature, she/he should do it as seperate module (like https://drupal.org/project/acdx_references) or for now at least in a sandbox.

rcodina’s picture

Issue summary: View changes

Why not implent this inside the module? Like @johnv stated users want same widgets on node edit forms and view forms. I think this would bring a key feature for this module. Can anyone please post a patch?

x.flimon@gmail.com’s picture

Hi,

@junetellain626 : Did you come up with a solution to prevent creating new taxonomy items?
I'm stuck with the same issue..

Thanks

LNakamura’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hi, all - we have no plans for adding support for additional entities to Autocomplete Deluxe.

That said, the following are available, and I believe should address most, if not all, of the questions above:

  • more detailed instructions for converting an autocomplete term reference exposed Views filter to an Autocomplete Deluxe widget are now in the README for the latest 2.x dev code
  • an Autocomplete Deluxe for References issue with a patch to enable it for Entity References: #1295034: Compatability with Entity References
  • if you want to prevent the adding of new terms in an Autocomplete Deluxe widget, Content Taxonomy will do the trick (I just tried it with the latest 2.x dev code)

Try them out and let us know!

rajab natshah’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)