问题描述
版本-Jira v8.5.1的行为
我使用Beavhiours脚本已有几个月了,取得了巨大的成功。当前,它根据用户选择(列表,级联列表,复选框)显示/隐藏各种字段。我想根据单选按钮的值来设置文本字段的必需/可选条件。
IS:正确选择单选按钮时,文本字段必填状态不会更改 应该:当我选择特定的单选按钮时,文本字段应为必填字段
目标:1.当单选按钮(radioField)和级联列表(listField)都满足特定选择条件时,使用Adaptavist行为将textField设置为必需。
这是我的行为“字段”之一中的示例代码:
// set pointers to custom fields (list,radio button,and text)
def listField = getFieldByName ("My List")
def radioField = getFieldByName ("My Radio")
def textField = getFieldByName ("My Text")
// get cascading list value (parent and child)
String listString = listField.getValue()
// if cascading list matches one of two selections,show the radio button field
if ((listString == "[Parent1,Child1]") || (listString == "[Parent1,Child2]")) {
radioField.setHidden(false)
} // otherwise,hide the radio button field
else {
radioField.setHidden(true)
}
// get the value of the radio button field
String radioString = radioField.getValue()
// if both the cascading list and radio button value match specific values,make the text field required
if ((listString == "[Parent1,Child1]") && (radioString == "Radio Option")) {
textField.setRequired(true)
}
// in all other cases,make the text field optional
else {
textField.setRequired(false)
}
除了使文本字段为必填项之外,此代码有效。通过以下步骤,我可以使文本字段成为必需字段:
- 将listString设置为“ [[Parent1,Child2]””
- 将radioString设置为“无线电选项”
- 将列表字符串设置为“ [Parent1,Child1]” 在这种情况下,我们选择一个列表选项,该选项显示单选按钮字段,但不满足将文本字段设置为必填条件(“ [Parent1,Child2]”)。然后,我们可以将单选按钮设置为正确的选项。然后将列表选项设置为满足第二个条件,即文本字段为必填项(“ [Parent1,Child1]”)。
鉴于此行为,似乎单选按钮字段值仅在我更改列表字段选择时才被更新。但是它不应该独立于我的列表选择吗?
其他信息: 更改选择时,所有单选按钮都不会更新其值。我通过在单选按钮值上使用log.warn然后在内置脚本“ View server log files”的“ atlassian-jira.log”的最后几行中检查了打印语句,确定了这一点。默认。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)