Username
Forgot password?
Welcome to our site!
Or Join with FTTF

Search AutoComplete Behavior Broken?, Inconsistant with Code Comments

1

794 views
Based on the comment in the code below,
the Auto Complete is not working as expected.

I tried on support.lampcms.com, my site, and on the latest code from git hub.

Please read the code comment, what I am expecting,
Then look at the behavior.

the current behavior.
Selecting an auto complete line with the mouse click, will put the text of that line into the search field
making you the press search, and hope the same result comes back.

What the comment indicates.
It will redirect the user the the selected autocomplete chosen question.

I have added alerts, and I can't understand the flow of the code.
Please LOOK.


/**

                 * Click on selected item in this autocomplete must
                 * NOT do the default thing but instead take
                 * to the url of the question. The purpose of this
                 * form is not really to autocomplete the form but
                 * to show questions with similar titles and if user click on one
                 * of them then take user to url of that question.
                 */
                id_title.ac.on('select', function (e) {
                    var qlink, result = e.result;
                        alert('call auto complete before');

                    if (result.raw && result.raw._id && result.raw.url) {
                        alert('call auto complete.');
                        e.preventDefault();
                        alert('call auto complete after prevent default');
                        qlink = web_root + '/viewquestion/' + qid_prefix + result.raw._id + '/' + result.raw.url;
                        window.location.replace(qlink);
                    }

                });


 
asked January 26, 2013 at 1:04 PM

 us

3 Answers

0
 
Hi Dmitir "The search form's autocomplete just enters the suggested results into the search form. It was always working like that, it's not a bug" - but this seems to be redundant. On searching the suggested search results, it only finds one link. It would be a nice user experience to have this implemented like the auto complete in the ask questions.
flag
answered January 27, 2013 at 4:24 AM
1
 
Actually you are correct, the current behaviour just fills in the search form and not takes user to the question.
I was able to reproduce it.

I'll investigate why this is happening.
flag
Edited Jan 26, 2013 06:49 PM
was able to reproduce this bug
answered January 26, 2013 at 6:45 PM
0
 
OK, I just looked at the javascript in qa.js again and it looks like it's not a bug
The behavior that you described (in the comments) applies only to autocomplete in the "title" of the questions form.
When you asking a new questions there is another auto-complete form that searches for similar questions as you typing the title of your question. That autocomplete will take you to the question when you click on one of the suggested results.

The search form's autocomplete just enters the suggested results into the search form. It was always working like that, it's not a bug.

There is a third autocomplete - for the tags form on the "ask question" form. That one inserts suggested tags into the tags field.

flag
answered January 26, 2013 at 7:20 PM

Your answer

Join with account you already have

FTTF

Preview

Alert