Search code examples
zend-framework2zend-formzend-db

zf2 How to achieve auto-complete when use fieldset


I have a web form generate by using zf2 fieldset, for one of the input field "Company Name" in this case, I want achieve auto-complete where the source for the select option comes from the database.

Thank for any advice in advance,

Frank


Solution

  • Here is one way to do it.

    • Make this fieldset launch a jquery function when you type in
    • This function will fetch data from an api controller in json
    • The controller asks for the data and returned them as json
    • one fetch you just have to display the data

    You can do this using the jquery typeahead

    • Here is an example
    • Here is a way to implement it

    Hope this will help you