crazycooky77 / ci_project4

0 stars 1 forks source link

[ENH] Custom select2 message for Add Set Not Found #43

Open crazycooky77 opened 7 months ago

crazycooky77 commented 7 months ago

When adding a set to a collection and searching for the ID or name in the list, if the ID/name doesn't exist, a generic "No results found" appears. A more specific error would be better.

When trying to address this (e.g. with the code block below):

To be enhanced in a future version.

if (window.location.pathname === '/add-set/') {
    $(document).ready(function () {
        $('#id_set').select2({
        placeholder: "Search set number or name",
        language: {
            noResults: function () {
                console.log('test')
                return $("testing");
            }
        }
        });
    });
}

<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script>