[% META title = 'HMRN » Treatment & Trial Options' -%]
<!-- BEGIN [% template.name %] -->
[% # PROCESS dumper.tt dump = opts %]
[% # error_codes_dfv_js %]
[% # PROCESS admin/misc_nav.tt page = 'error-codes' %]
<h2 align="center">HMRN treatments & clinical trial options</h2>
[% IF dfv_errors %]
<p class="error">[% c.config('msg').dfv_errors %]</p>
[% END %]
[% INCLUDE site/snippets/help.tt file = 'treatmentdetails' %]
[% # PROCESS site/js/jquery.tt # already loaded in html_wrapper %]
<script language="javascript" type="text/javascript">
<!--
function showhide_tx_detail(f,v) {
var t = f.tx_detail_id;
var tx_type_ids = [ [% opts.tx_type_ids.join(',') %] ];
// does value of 'v' match any of tx_type_ids array:
match = jQuery.grep(tx_type_ids, function (a) { return a == v; }); // alert(match);
/* alternative:
var match = 0;
for (i=0; i<tx_type_ids.length; i++) {
if (tx_type_ids[i] == v) {
match = 1;
break;
}
}
if (match) { .. }
*/
if (match.length) { // ie contains the value of tx_type_id
t.style.visibility='visible';
}
else {
t.style.visibility='hidden';
}
}
// use addLoadEvent function in common.js for onload:
[% visibility = opts.tx_details.size ? 'visible' : 'hidden' %]
addLoadEvent(
function() {
document.txDetails.tx_detail_id.style.visibility='[% visibility %]';
}
);
// tx_type_id onChange event for tx_detail_id select menu
$(document).ready(function () {
$('#tx_type_id').change( function() {
$('#tx_detail').load('[% app_url %]/hmrn_data/treatment_options', {
tx_type_id: $('#tx_type_id').val()
})
})
});
-->
</script>
<form method="post" action="[% app_url %]/hmrn/treatment_options"
[% error_codes_onsubmit %] name="txDetails" id="txDetails">
<p class="bold">
1) Select treatment type:
<select name="tx_type_id" id="tx_type_id" id="tx_type_id"
onchange="showhide_tx_detail(this.form,this.value)">
<option value=""></option>
[% FOREACH key IN opts.tx_types.keys.sort %]
<option value="[% opts.tx_types.${key} %]">[% key %]</option>
[% END %]
</select>
</p>
<div class="indent">
<span class="bold">or add new:</span>
<input type="text" size="25" name="new_tx_type" />
[% error_tx_type_id %]
[% site.html.submit %] [% site.html.reset %]
</div>
<p class="bold">
2) Options for selected Tx type:
</p>
<!-- // replaced by ajax output after selection of tx_type_id: -->
<div class="indent">
<select name="tx_detail_id" id="tx_detail" [% site.html.readonly %]>
[% IF opts.tx_details.size %]
<option value=""></option>
[% FOREACH opt IN opts.tx_details %]
<option value="[% opt.key %]">[% opt.value %]</option>
[% END; END %]
</select>
<b>new</b>: <input type="text" size="35" name="new_tx_detail" />
[% error_tx_detail_id %]
[% site.html.submit %] [% site.html.reset %]
</div>
</form>
<!-- END [% template.name %] -->