input with datalist

input with datalist

montoyammontoyam Posts: 568Questions: 136Answers: 5
edited February 2020 in Free community support

html5 has a text/dropdown combo box so the user can free-type or select from drop-down.: https://stackoverflow.com/questions/5650457/html-select-form-with-option-to-enter-custom-value

Is there a way to use this in Editor?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    OOooo - I wasn't aware of that option in HTML5!

    Yes you could use that with Editor - the datalist element would be up to you to create and update the options of, but once you have it in the document add:

    attr: {
      list: 'my-data-list'
    }
    

    to the object for your field.

    Allan

  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    I see Select2 has a feature like this too. I may look into that first. Thank you though.

  • markco84markco84 Posts: 13Questions: 1Answers: 0

    Is it possible to get the data-value field instead of the value?

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    I'm afraid I don't quite understand what you mean by the data-value. Do you mean an attribute, or something else? What else do you want to do with it?

    Thanks,
    Allan

  • markco84markco84 Posts: 13Questions: 1Answers: 0

    Yes with data list I was trying to use data-value as an attribute. I ended up using select2 as well. It allowed me to set a value but still display a user friendly item.

    Thanks,

This discussion has been closed.