Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hi Drupal Core, here's a suggestion for better user functionality.
Summary
- Turn the return value of autocomplete.js into an array.
- When selected, autocomplete.js fills in the textfield with the value of the array_key instead of the full array.
- The array_key would be specified in the feeding function value.
Where would we use this?
User autocomplete with pictures.
Description
Autocomplete works on strings. Find a string, make an array with strings, return the strings. This seems pretty limited for user experience. We would have to change code like this.input.value = $(node).data('autocompleteValue');
to look for the main field. The HTML would have to be structured too.
In a perfect world, we could do this in D7. If there's no "main-field" specified, return to normal behaviour.
Sample HTML return
(not including the ARIA)
<div id='autocomplete'>
<div id='autocomplete-0' class= 'autocompleteValue'>
<div class="field-0">AAA</div>
<div class="field-1 main-field">AAA</div>
<div class="field-2">AAA</div>
</div>
<div id='autocomplete-1' class= 'autocompleteValue'>
<div class="field-0">BBB</div>
<div class="field-1 main-field">BBB</div>
<div class="field-2">BBB</div>
</div>
</div>
What do you think?
Comments
Comment #1
nagiek CreditAttribution: nagiek commentedI had something like this in mind...
Comment #2
Everett Zufelt CreditAttribution: Everett Zufelt commentedSee #675446: Use jQuery UI Autocomplete
Comment #3
nagiek CreditAttribution: nagiek commentedcan't wait.
Comment #4
nagiek CreditAttribution: nagiek commentedComment #5
nagiek CreditAttribution: nagiek commentedComment #6
nod_Since we'll just go ui autocomplete anyway.