Skip to content

Django select2 field in pure html in modal with already used field_id #37

@Mergpijp

Description

@Mergpijp

Goal
I am trying to make select2 work in pure html in a modal.

Problem
I have a workaround by using another field_id from another form. Is this the right way? Do I need to create a field_Id for each select2 field?

Code Snippet
Please provide a code snippet of your problem:

            <div class="form-group" >
               <label for="id_filecategory" class="">
               Filecategory
               </label>
               <div class="">
                  <div class="input-group">
                     <select name="filecategory" data-minimum-input-length="0" data-allow-clear="true" data-placeholder="---------" data-ajax--url="/select2/fields/auto.json?field_id=Mjc5NDMxNzU1OTM0NA%3A1lEEm5%3AK_HUKQUF1aEwQZZGHySFs6tbuzc" data-ajax--cache="true" data-ajax--type="GET" class="modelselect2widget form-control django-select2 django-select2-heavy" id="id_filecategory">
                        <option value=" " selected></option>
                     </select>
                     <span class="input-group-append"><button  class="btn btn-danger" onClick="window.open(&#39;/filecategory/new&#39;, &#39;_blank&#39;, &#39;width=1000,height=600,menubar=no,toolbar=no&#39;);" type="button">+</button>
                     </span>
                  </div>
               </div>
            </div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions