Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthormetkelb
     
    I am using the following code to implement an auto complete:

    echo $javascript_macros_helper->text_field_with_auto_complete('author','name');

    Everything works and the text box shows and works ...Except that the result box is always hidden (display:none);
    I used javascript to change the display style and I thought I figured it out :

    $('author_name_auto_complete')style.display = '';

    Now when i type text the results show up, but as soon as I delete the text (empty string) the display style changes back to 'none';

    Is there a smarter fix -- or am I approaching the entire auto complete the wrong way??

    Thank you in advance for any response
    • CommentAuthormetkelb
     
    Here is my controller function to respond to the ajax call

    function auto_complete_for_author_name(){
    $name = $this->params['author']['name'];
    $this->authors = & $this->Author->find('all', array('conditions' => array("name Like :name", ':name' => $name.'%')));

    }

    And my partial file for templating

    <div class="auto_complete">
    _{Template result}
    <ul>
    {loop authors}
    <li><%= link_to author.name, :action=>'show' , :id=>author.id %></li>
    {end}
    </ul>
    </div>

    I hope I provided enough information ...