RSS Git Download  Clone
Raw Blame History
<!-- BEGIN [% component.name %] %] -->
    [%
        category_ids = []; # for showhide_screens() function
        FOREACH entry IN categories;
            NEXT UNLESS entry.active.match('yes') AND entry.category_type.match('main');
            category_ids.push(entry.id);
        END;
    %]
    
	<script language="javascript" type="text/javascript">
		function showhide_diagnoses(f,v) {
			var t = f.diagnosis_id;
            var categoryIds = [ [% category_ids.join(',') %] ];

			// does value of 'v' match any of categoryIds array:
			match = jQuery.grep(categoryIds, function (a) { return a == v; }); // alert(match);

			if (match.length) { // ie contains the value of category_id
				t.style.visibility='visible';
			}
			else {
				t.style.visibility='hidden';
			}			
		}

		// use addLoadEvent function in common.js for onload:
		[% UNLESS diagnosis_name %]
		  addLoadEvent(
			function() { 
				document.diagnosis.diagnosis_id.style.visibility='hidden';
			}
		  );
		[% END %]

		// diagnosis_category onChange event for diagnosis_id select menu
		$(document).ready(function () {
			$('#diagnosis_category').change( function() {
				$('#diagnosis_term').load('[% c.query.url(path_info=1)
					%]/diagnosis_terms', {
						category_id: $('#diagnosis_category').val()	
				})
			})
		});		
	</script>
<!-- END [% component.name %] %] -->