Coder Social home page Coder Social logo

Comments (5)

Honatas avatar Honatas commented on June 15, 2024

The same way you would with any other input. Have in mind that for serializeArray() to work, you need to have set the 'name' attribute of your input.

from bootstrap-4-autocomplete.

VILLAN3LL3 avatar VILLAN3LL3 commented on June 15, 2024

Thank you for your answer. But this way only the label will be serialized, not the value

from bootstrap-4-autocomplete.

Honatas avatar Honatas commented on June 15, 2024

Well, a label is one thing, a value is another and the id is even another. Anyway, that's how jQuery's serializeArray() works, and this has nothing to do with this lib. If you want another result, you should implement your own serialization.

from bootstrap-4-autocomplete.

VILLAN3LL3 avatar VILLAN3LL3 commented on June 15, 2024

Yes, but when using a dropdown we can pass an option label and value and serializeArray() will use the option value of the selected option. With this autocomplete control only the label is accessible.

from bootstrap-4-autocomplete.

Honatas avatar Honatas commented on June 15, 2024

You have to implement the onSelectItem callback to get this value. I'd advise to set it to a hidden input on your form, and leave the autocomplete input without a name so it doesn't get serialized.

from bootstrap-4-autocomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.