{{define "choose"}}
    <script>
        $("select.{{.Field}}").on("select2:select", function (e) {
            if (e.params.data.text === {{.Val}} || e.params.data.id === {{.Val}}) {
                if ($("select.{{.ChooseField}}").length > 0) {
                    $("select.{{.ChooseField}}").val("{{.Value}}").select2()
                } else {
                    $(".{{.ChooseField}}").val({{.Value}})
                }
            }
        })
    </script>
{{end}}