+ function getOptionList() {
+ var list = [];
+ _.forEach(options, function(option) {
+ var opt = _.cloneDeep(option);
+ if ($('[name="config_' + opt.id + '"]').length) {
+ opt.disabled = true;
+ }
+ list.push(opt);
+ });
+ return {results: list, text: 'id'};
+ }
+
+ function validateJson() {
+ var val = $(this).val();
+ $(this).parent().removeClass('crm-error');
+ if (val[0] === '[' || val[0] === '{') {
+ try {
+ JSON.parse(val);
+ } catch (e) {
+ $(this).parent().addClass('crm-error');
+ }
+ }
+ }
+