for some reason, empty values were getting rendered as [] in autocomplete val, fixed

This commit is contained in:
Sanj 2012-07-19 23:52:14 +05:30
parent 05ffc629b2
commit 0811875f75
2 changed files with 3 additions and 1 deletions

View File

@ -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>

View File

@ -80,6 +80,8 @@ $(function(){
if ($.trim(id) !== '') {
var title = $this.attr("data-title");
$this.select2("val", {'id': id, 'title': title});
} else {
$this.select2("val", null);
}
});