如今,网络上的许多表单选项都提供条件表单字段(例如,您从哪里听说我们?如果选择了“其他”,则会出现一个附加字段来说明原因)。如果您能像处理新主题表单模板一样,开始朝着类似(但更强大)的方向发展,那就太好了,但需要增加一个能够依赖于另一个字段 ID 的功能,特别是该字段的输入。例如,它可能看起来像这样:
- type: dropdown
id: user-type
choices:
- "Developer"
- "Application Administrator"
- "Analyst"
attributes:
none_label: "Choose your role..."
label: "Which option best describes your job"
validations:
required: true
- type: dropdown
id: developer-type-programming-language
depends: user-type
choices:
- "Developer"
choices:
- "Developer"
- "Application Administrator"
- "Analyst"
attributes:
none_label: "Preferred programming language..."
label: "What is the primary programming language used in your role?"
validations:
required: true