I am using a JavaScript to dynamically output a specific default text to the additional comments box in Bugzilla, based on the bug status which is selected from the drop down menu. I have tried using 'bug.bug_status' but this only changes on the submission of the page. The variable I have found which populates the drop down menu is 'bug_status.name' but when I try use this variable, it does not seem to be recognised. Has anyone any suggestions what may be causing the problem? Has anyone tried this before?
The following code has been placed at the start of the knob.html.tmpl file.
[% PROCESS global/variables.none.tmpl %]
[% # Output a specific default content in the comments box depending on bug status. %]
<script type="text/javascript">
<!--
var messages = ['Message 0', 'Message 1', 'Message 2', 'Message 3', 'Message 4', 'Message 5', 'Message 6'];
function changetext(selectObj){
var textAreaElement = document.getElementsByName("comment")[0];
[% IF (bug_status.name == "ASSIGNED") %]
textAreaElement.value = messages[4];
[% ELSIF(bug_status.name == "RESOLVED") %]
textAreaElement.value = messages[5];
[% ELSE %]
var variable1 = 0;
variable1 = bug_status.name
textAreaElement.value = variable1;
[% END %]