子表单
可复用的表单片段,用于 list 字段、yaml 字段和向导页面
子表单是一个可复用的表单片段。它不会出现在磁贴视图中,也不能直接提交。它由以下方式引用:
A reusable form fragment used as the per-row editor of a list field, or as the single-object editor of a yaml field with the subform property.
Subforms are not shown in the tile view and cannot be submitted directly.
They share the same field types and validation rules as regular forms.
Address subform
- name: Address
type: subform
fields:
- name: street
type: text
label: Street
required: true
- name: city
type: text
label: City
required: true
- name: country
type: text
label: Country
required: true
- name: My Main Form
type: ansible
playbook: site.yml
roles:
- default
fields:
- name: addresses
type: list
label: Addresses
subform: Address属性
子表单没有特定于类型的属性。它们只使用通用表单属性: name 、 description 、 help 、 type 和 fields 。
当子表单用作向导页面时,它的 description 和 help 为该步骤的 title 和 help 提供默认值。它还可以设置 showHelp ,在页面加载时展开该帮助。
执行相关的属性( playbook 、 template 、 roles 、 inventory 等)不适用于子表单,因为子表单从不直接提交。