Topic: Autocomplete entries as links

Mighty Midget pro asked 4 years ago


Hi

On an earlier version of MDB (4.7.3) I had built a search function using autocomplete. The site has tags around the autocomplete entries so that when clicked on the browser would jump to the linked page. I've updated to 4.8.7 and the behaviour has changed so that the clicked link doesn't work. It just populates the search box. Is there a way of overriding this behaviour so that it behaves as previously?

*Expected behavior*Opens linked page*Actual behavior*Populates search box*Resources (screenshots, code snippets etc.)*tag data example

<li><a href="http://test.test/148">test entry</a></li>

Aliaksandr Andrasiuk staff answered 4 years ago


Hi,

Unfortunately, I can't think up what can help solve this problem.

If I will be able to solve this problem I will inform you in this ticket.

Best regards.


Mighty Midget pro answered 4 years ago


Hi,

The code on the page is as below

<div class="form-group md-form">
                                <input type="search" class="form-control mdb-autocomplete" id="form-autocomplete"
                                       data-request="autocomplete::onAutocomplete" data-track-input="true"
                                       name="autocomplete" data-request-update="dataTags: '#dataTags'"
                                       autocomplete="off">
                                <button class="mdb-autocomplete-clear">
                                    <svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg">
                                        <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
                                        <path d="M0 0h24v24H0z" fill="none" />
                                    </svg>
                                </button>
                                <label for="form-autocomplete">Search</label>

The server returns a JSON encoded array and calls the script

var tags = ["<a  href=\"http:\/\/test.test\/advisers\/122\">Test Adviser LLP<br><small>(Auditors)<\/small><\/a>","<a href=\"http:\/\/test.test\/advisers\/1736\">Another test LLP<br><small>(Auditors)<\/small><\/a>"];
$('#form-autocomplete').mdbAutocomplete({
    data: tags
});

Previously the behaviour was the entries would be working links when clicked. The behaviour now is to just populate the search bar with the entry when clicked. Is it possible to revert back to that behaviour?


Aliaksandr Andrasiuk staff answered 4 years ago


Hi,

Can you show the code example? Without it, I can't reproduce the above behaviour in my project.

Hope you understand, thanks.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.5
  • Device: desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No