view shared_view/includes/dojo/form/CheckboxSelect.tt @ 16:e69c970c3ddd default tip

sync
author sergey
date Tue, 20 May 2014 01:28:48 +0400
parents 573272ec604b
children
line wrap: on
line source

[%
	BLOCK INIT;
    	document.dojo.modules.push("dijit/form/CheckBox");
    END;
    IF metadata.inputType == 'password';
    	value = '';
    ELSE;
    	value = metadata.inputValue;
    END;
    
    selected = {};
    
    FOREACH item IN metadata.inputValue;
    	selected.${item} = 1;
    END;
    
    options = [];
    valueField = "roleName";
    labelField = "roleName";
    
    FOREACH item IN resource.GetDataSource(metadata.GetSchemaProperty('data-source-name')).data;
    	options.push({
    		label = item.$labelField,
    		value = item.$valueField,
    		selected = selected.${item.$labelField}
    	});
    END; 
%]
[% FOREACH option IN options %]
	<div>
		<input type="checkbox" name="$prefix" value="$option.value"[% IF option.selected %] checked="true"[% END %]/><span>$option.label</span>
	</div>
[% END %]