fix customfield type "button" without any value stalls whole addressbook

This commit is contained in:
Ralf Becker 2014-11-14 12:38:40 +00:00
parent 5aacf69ab9
commit 275d733c22

View File

@ -503,20 +503,25 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput
attrs.label = field.label; attrs.label = field.label;
if (this._type == 'customfields-list')
{
// No buttons in a list, it causes problems with detached nodes
return false;
}
// Simple case, one widget for a custom field // Simple case, one widget for a custom field
if(Object.keys(field.values).length == 1) if(!field.values || typeof field.values != 'object' || Object.keys(field.values).length == 1)
{ {
for(var key in field.values) for(var key in field.values)
{ {
attrs.label = key; attrs.label = key;
attrs.onclick = field.values[key]; attrs.onclick = field.values[key];
} }
return !attrs.readonly; if (!attrs.label)
}
else if (this._type == 'customfields-list')
{ {
// No buttons in a list, it causes problems with detached nodes attrs.label = 'No "label=onclick" in values!';
return false; attrs.onclick = function(){ return false; };
}
return !attrs.readonly;
} }
else else
{ {