[Django]-Editable choice field/drop down box in Django forms

0👍

maybe you can do:

Choices1 = [("0", _("0")), ("1", _("1")),("2", _("2"))[("3", _("3"))]

options = (value for key, value in Choices1 )

list =  forms.CharField(widget=forms.Textarea(attrs{'selectBoxOptions':';'.join(options)})),label=_("ListExample"),required=False)

in your html, you could try:

<form>
    {{form.as_p}}
</form>


<script type="text/javascript">
    createEditableSelect(document.forms[0].myText);
</script>

0👍

For future reference: the solution is now available with html5 which allows editable dropdown list.
And so with Django: https://stackoverflow.com/a/32791625/1937033

👤ThePhi

Leave a comment