Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 297707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:39:51+00:00 2026-05-12T06:39:51+00:00

Using the Ajax helper for CakePHP (currently 1.2.3.8166) to provide an $ajax->autoComplete list of

  • 0

Using the Ajax helper for CakePHP (currently 1.2.3.8166) to provide an $ajax->autoComplete list of results, and giving a result list back as the rendered view, if you use the mouse (and even the mouse wheel) to scroll results, all is well. Using the arrow keys, on the other hand, has the nasty effect of awkwardly scrolling the view: if I press down, the select box and the whole page move to the bottom of the browser’s view pane; pressing up has the opposite effect of moving it to the top.

Has anyone else noticed this behaviour, and thought of something? the resulting list is provided by, e.g., this code (this gets $people from the autoComplete() function in the controller):

<ul>
<?php foreach($people as $person): ?>
<li><?php echo $person['Person']['id']; ?></li>
<?php endforeach; ?>
</ul>

(Just an example, I actually show the id and name / surname / commercial name).

The CSS for the list is as follows:

div.auto_complete {
    position: absolute;
    width: 250px;
    background-color: white;
    border: 1px solid #888;
    margin: 0px; padding: 0px;
}
div.auto_complete ul{
    list-style: none;
    margin: 0px;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:39:52+00:00Added an answer on May 12, 2026 at 6:39 am

    I received the answer to this problem on the cake-php newsgroup (available on http://groups.google.com/group/cake-php ).
    The poster pointed to this page with the solution, and I copy it here:

    1. Open the controls.js file (should be in app/webroot/js)
    2. Search for the markPrevious function and change it to:

      markPrevious: function() {
          if (this.index > 0) {
              this.index--;
          } else {
              this.index = this.entryCount-1;
              this.update.scrollTop = this.update.scrollHeight;
          }
          selection = this.getEntry(this.index);
          selection_top = selection.offsetTop;
          if (selection_top < this.update.scrollTop) {
              this.update.scrollTop = this.update.scrollTop-
              selection.offsetHeight;
          }
      },
      
    3. Search the markNext function and change it to:

      markNext: function() {
          if(this.index < this.entryCount-1) {
              this.index++;
          } else {
              this.index = 0;
              this.update.scrollTop = 0;
          }
          selection = this.getEntry(this.index);
          selection_bottom = selection.offsetTop+selection.offsetHeight;
          if(selection_bottom > this.update.scrollTop+this.update.offsetHeight) {
              this.update.scrollTop = this.update.scrollTop + selection.offsetHeight;
          }
        },
      
    4. Search for the updateChoices function and change lines

      this.stopIndicator();
      this.index = 0;
      

      to

      this.stopIndicator();
      this.update.scrollTop = 0;
      this.index = 0;
      
    5. Finally, try the behavior. If it doesn’t work at first, try deleting the cache files in app/tmp/cache (or clear your favorite server-side cache), your browser cache, and try again. Clearing app/tmp/cache worked for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to update more then one partial using the ajax form_remote_for helper Currently
I am using ajax via js helper in my cakephp application; for this I
If I am using an Ajax.ActionLink helper, and I need to pass a couple
I'm just starting using cakePHP and I saw on that there was an AJAX
setup: cakephp, jquery 1.8.7, cakephp.bee.pl ajax helper I have a website who is set
I'm trying to convert a form from synchronous to asynchronous using the Ajax.BeginForm helper
I'm currently trying to do the same function the Ajax.BeginForm helper does but instead
Using cake 2.2. I currently have a form (built using the form helper) that
I'm using the Ajax.ActionLink helper to generate a link to delete a record. This
I am currently trying to program my first ajax interface using Rails. The application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.