我正在尝试强制某些字段在 Bugzilla 中创建错误,根据我的阅读,最简单的方法是使用 JavaScript。我使用的代码如下所示,但似乎不起作用。我的 Javascript 知识非常有限,所以我认为这是我的编码错误。
<script type="text/javascript">
<!--
function mandatory_text_check(){
if (this.form.short_desc.value == '')
{
alert('Please enter a summary sentence for this [% terms.bug %].');
return false;
}
else if (this.form.estimated_time.value == '0.0' && this.form.cf_issuetype.value == 'Task')
{
alert('Please enter an estimated time for completion of this task.');
return false;
}
else
return true;
}
-->
</script>
// Function is called from the commit button on the bottom of the page
<input type="submit" id="commit" value="Commit"
onclick="mandatory_text_check();">