我正在使用 JavaScript 根据从下拉菜单中选择的错误状态,将特定的默认文本动态输出到 Bugzilla 中的附加注释框。我曾尝试使用“bug.bug_status”,但这只会在提交页面时发生变化。我发现填充下拉菜单的变量是“bug_status.name”,但是当我尝试使用这个变量时,它似乎没有被识别。有没有人提出任何可能导致问题的建议?有没有人试过这个?
以下代码已放置在旋钮.html.tmpl 文件的开头。
[% 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 %]