#autocomplete

Niels Hackius - July 10, 2007 - 19:40
Project:AHAH Forms Framework
Version:5.x-1.5-5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hello,
I have the following problem with AHAH:

Is it possible that this module doesn't work with the #autocomplete_path -option from Forms API?

How do I make it work together? Any pointer would be helpful - it is just a little thing after all.

Greetings.

#1

Niels Hackius - July 11, 2007 - 17:13
Category:feature request» support request
Priority:minor» normal

I found a pretty bad solution:
upon creating your subform, add this to each element

'#attributes' => array('onClick' => "Drupal.autocompleteAutoAttach();")

however: you don't get all the beauty of it, for example once you press Enter the thing gets submitted.

#2

macm - August 2, 2007 - 13:13

My solution:

<?php
    $element
['new_item']['text'] = array (
       
'#type' => 'textfield',
       
'#title' => t( 'Text' ),
       
'#autocomplete_path' => 'taxonomy/autocomplete/9',
       
'#size' => 40,
       
'#maxlength' => 128,
    );
?>

Works fine!

#3

macm - August 2, 2007 - 13:14

My solution:

<?php
    $element
['new_item']['text'] = array (
       
'#type' => 'textfield',
       
'#title' => t( 'Text' ),
       
'#autocomplete_path' => 'taxonomy/autocomplete/1'// Where 1 is the No of your taxonomy
       
'#size' => 40,
       
'#maxlength' => 128,
    );
?>

Works fine!

#4

Niels Hackius - August 31, 2007 - 21:19

so you are saying you didn't need a hack, but I need one? strange...

#5

Niels Hackius - September 5, 2007 - 13:53
Category:support request» bug report

okay, uhm - I just downloaded a fresh copy of drupal, and a fresh copy of aha and this doesn't work. I tried to insert this line:
'#autocomplete_path' => 'users/autocomplete', as I tried before and as you mentioned. However upon pressing the cursor-button "down" and then pressing "Enter" The form gets submitted.

So if your Username is "Bob" and you insert "B" the dropdown is present to you - and even though you selected Bob from the List and hit enter - only a "B" will be submitted.

Moreover after the form is submited the newly created input field for the todo-list doesn't provide the autocomplete-capabilities anymore.

#6

beltofte - September 5, 2007 - 14:25

I had the same problems as you have Niels. I added '#attributes' => array('onClick' => "Drupal.autocompleteAutoAttach();") to all my fields where i need autocomplete. It fixes the problem with the autocomplete that does not work after the form is submittet.

But i stil have the problem with "enter" in the autocomplete field. I was thinking about some javascript to fix the problem, but have not looked into it yet.

#7

fall_0ut - October 22, 2007 - 15:48

The only solution for this, seems to be by including the function Drupal.autocompleteAutoAttach(); at the function Ahah.attach_all_bindings.

Now, ideally Ahah should provide a javascript hook, so we could dynamically include more javascript that should be run "after" Ahah submitted and fetched new data from the server.

#8

Niels Hackius - October 22, 2008 - 13:39
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.