This commit is contained in:
Anand Doshi 2014-06-03 14:10:53 +05:30
parent 964711a3e0
commit 1dc4968c3a
2 changed files with 9 additions and 4 deletions

View file

@ -243,9 +243,14 @@ frappe.dom.set_box_shadow = function(ele, spread) {
// create options
for(var i=0; i<options_list.length; i++) {
var v = options_list[i];
value = v!=null ? (v.value==undefined ? v : v.value) : null;
label = v!=null ? (__(v.label || v)) : null;
$('<option>').html(label || "").attr('value', value).appendTo(this);
if (is_null(v)) {
var value = null;
var label = null;
} else {
var value = is_null(v.value) ? v : v.value;
var label = is_null(v.label) ? __(v) : __(v.label);
}
$('<option>').html(cstr(label)).attr('value', value).appendTo(this);
}
// select the first option
this.selectedIndex = 0;

View file

@ -23,7 +23,7 @@ function toTitle(str){
}
function is_null(v) {
if(v===null || v===undefined || (v || "").trim()==="") return true;
if(v===null || v===undefined || cstr(v).trim()==="") return true;
}
function set_value_in(ele, v, ftype, fopt, doc) {