I would like to do a form_alter and change a form element into an autocomplete deluxe, but it does not work fully for now.
Putting the element to #type => 'autocomplete_deluxe', I havec #autocomplete_options working quite well, but not #autocomplete_deluxe_path for now (it works well for simple autocomplete field though). There is a special formatting for such autocomplete path ? Or there is something more to do ?
Comments
Comment #1
open social commented'#autocomplete_deluxe_path' => url('autocomplete_deluxe/taxonomy/field_categories', array('absolute' => TRUE)),
something like this will do
Comment #2
zulfierken commentedI am trying to use autocomplete deluxe in a form.
$form['order_creation']['account_owning_order'] = array(
'#type' => 'autocomplete_deluxe',
'#title' => t('Choose User'),
'#autocomplete_options' => $options,
'#multiple' => FALSE,
'#value' => $options,
'#autocomplete_min_length' => 2,
);
My options are:
Array
(
[0] =>
[10010101] => 10010101 James Lopez
[10010102] => 10010102 Martin Lopez
[10010103] => 10010103 Andy Hope
)
My result is:
[account_owning_order] => 0
[textfield] => 10702 John Doe
[list_value] => 0
Normally, it should return array key as textfield value. Is there anything that I am missing?
By the way, I had to add a null array because default value does not work
Comment #3
118218 commentedThank you for your module, it's very nice!
I am currently building a module, and I'd use fields "autocomplete deluxe".
How do I?
Comment #4
hass commentedSounds like the question has been answered.
Comment #6
mstef commentedUpdated to beta7, and this no longer works. I use #type => 'autocomplete_deluxe', the widget appears like it should, but you cannot enter text into the field, and the drop-down button doesn't do anything when clicked.
Odd because the diff between beta6 and 7 doesn't seem like it would affect this. Perhaps the mistake is on my end?
Comment #7
mstef commentedMy mistake.. as expected
Comment #8
nortmas commentedzulfierken, you should replace $element['textfield'] to $element[$element['#name']] in functions autocomplete_deluxe_element_process and autocomplete_deluxe_after_build
Comment #9
zulfierken commentedI just tried to use 7.x-2.0-beta2 version programmatically;
$form['choose_user_id'] = array(
'#type' => 'autocomplete_deluxe',
'#title' => t('Choose User'),
'#autocomplete_options' => $options,
'#default_value' => 'select',
'#multiple' => FALSE,
'#size' => 40,
'#autocomplete_min_length' => 2,
);
And unfortunately, it shows a simple textfield without ajax.
How can I choose options with autocomplete? or How can I use this version programmatically?
Comment #10
franzI had to add "#parents" => array($element['#name'], 'value_field'), on $element['value_field']
Comment #11
Alexander Matveev commentedGreat module, thank you!
But how can I set default value with '#autocomplete_deluxe_path'?
I mean, if my json values are:
And I must display 'one' as field default value, but somewhere must be '1' set as key.