Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthormetkelb
    • CommentTimeOct 10th 2008
     
    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
    • CommentTimeOct 10th 2008
     
    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 ...
Add your comments
    Username Password
  • Format comments as