Html 字段
表单中的富 HTML 内容
属性
html 字段可用的属性,按用途分组:
| 属性 | 说明 |
|---|---|
| basic | |
| name string / 必填 / 唯一 | Field name
This attribute represents the name of the form field. |
| type string / 必填 | Field type
Other attributes might only be available for some field types. 值: html |
| label string | Field label
A friendly name/label for the field. Note: if not set, the field name is used as label, but not when type is html. Since 6.0.3: Supports placeholders for dynamic labels (e.g., |
| data | |
| expression string | A javascript expression.
By default this javascript is evaluated on the server side and limited to predefined functions (for security). However in combination with tip: use the alias |
| interaction | |
| dependencyFn string 在版本 4.0.0 中添加 | The dependency logical function
This attribute represents the logical function between multiple dependencies. 选项:
|
| dependencies list / elements=object | Show/hide this field based on the values or other fields
Each dependency element is either an object with the following 2 attributes:
Or with the following 2 attributes:
Use in combination with attribute |
| output | |
| output boolean 在版本 6.2.0 中添加 | Include field value as extravar
Form fields are by default sent as extravars. 默认值: true |
| security | |
| noLog boolean 在版本 2.2.3 中添加 | Disable backend logging
Disables logging in the backend, to hide passwords for example. 默认值: false |
| validation | |
| ignoreIncomplete boolean | Allow form submit on non-evaluated placeholders
When an expression-based field has placeholders, 默认值: false |
| visualization | |
| group string | The field group name
With this attribute you can group fields together. |
| line string 在版本 4.0.3 中添加 | The field line name
With this attribute you can group fields in a single line together. |
| width string 在版本 4.0.3 中添加 | The field width
With this attribute you can set the width of a field. 选项:
|
示例
html 字段示例(YAML):
Alert
字段定义(YAML):
- type: html
name: alert
expression: |
'<div class="alert alert-danger" role="alert">
danger mister robinson !
</div>'
- type: html
name: image
expression: |
'<img src="https://dummyimage.com/16:9x1080" />'
- name: header
type: html
expression: |
'<h3 class="title is-3">Your own title</h3>'
Link opening in a new tab
字段定义(YAML):
- type: html
name: documentation
expression: |
'<a href="https://ansibleforms.com/" target="_blank">Read the documentation</a>'