for some reason, empty values were getting rendered as [] in autocomplete val, fixed
This commit is contained in:
parent
05ffc629b2
commit
0811875f75
|
@ -1,2 +1,2 @@
|
||||||
<input type="hidden" id="id_{{name}}" name="{{name}}" data-ctype="{{ ctype.id }}" class="select2class" data-id="{{ value }}" data-title="{% if title %} {{ title }} {% endif %}" style="width:600px;" /> <a href="/popup_form/{{ ctype.id }}" class="popup_add_btn" title="Add new" id="add_{{name}}" onclick="return showAddAnotherPopup(this);">+</a>
|
<input type="hidden" id="id_{{name}}" name="{{name}}" data-ctype="{{ ctype.id }}" class="select2class" data-id="{% if value %}{{ value }} {% endif %}" data-title="{% if title %} {{ title }} {% endif %}" style="width:600px;" /> <a href="/popup_form/{{ ctype.id }}" class="popup_add_btn" title="Add new" id="add_{{name}}" onclick="return showAddAnotherPopup(this);">+</a>
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,8 @@ $(function(){
|
||||||
if ($.trim(id) !== '') {
|
if ($.trim(id) !== '') {
|
||||||
var title = $this.attr("data-title");
|
var title = $this.attr("data-title");
|
||||||
$this.select2("val", {'id': id, 'title': title});
|
$this.select2("val", {'id': id, 'title': title});
|
||||||
|
} else {
|
||||||
|
$this.select2("val", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user