fields.yaml 中单个字段的多个触发器 (OctoberCMS)
Multiple Trigger on single Field in fields.yaml (OctoberCMS)
我目前正在尝试将触发器添加到在单个字段上具有多个触发器的表单。
在我的例子中,当 select intetnal 它触发 contenttype 然后它显示 video 或 文章 基于 selection。在完成所有事情后,当我 select external from link 时,它不会触发关闭 contenttype
我正在尝试但没有工作:
link:
label: 'Internal Or External Link'
options:
internal: Internal
external: External
span: full
default: internal
required: 1
type: dropdown
comment: 'Select Link Type'
external_link:
label: 'External Link'
span: full
trigger:
action: show
field: link
condition: 'value[external]'
type: text
comment: 'Enter External Link'
content_type:
label: 'Content Type'
options:
video: Video
article: Article
span: full
trigger:
action: show
field: link
condition: 'value[internal]'
type: dropdown
comment: 'Select Content Type'
videolink:
label: 'Video Link'
span: full
trigger:
action: show
field: content_type
condition: 'value[video]'
type: text
comment: 'Enter Video Link'
article_content:
label: 'Article Content'
size: large
span: full
trigger:
action: show
field: content_type
condition: 'value[article]'
type: richeditor
comment: 'Add Article Content'
嗯,你可以做到,但我们需要确保content_type
在隐藏时清空
所以,我们可以这样做
external_link:
label: 'External Link'
span: full
trigger:
action: hide
field: link
condition: 'value[internal]'
type: text
comment: 'Enter External Link'
content_type:
label: 'Content Type'
emptyOption: -- select a status --
options:
video: Video
article: Article
span: full
trigger:
action: hide|empty
field: link
condition: 'value[external]'
type: dropdown
comment: 'Select Content Type'
我们可以使用 multiple actions
来完成我们的工作。是的,我们还需要为 content_type
添加 emptyOption
以使其为空。
所以当 link
值为 external
时,它将 hide
和 empty
字段 content_type
所以为了那个反应 videolink OR article_content
无法获得它的值,因为 content_type
将是 empty
,所以它们也 hide with that
.
For the sake of simplicity I am putting diff images so you get better idea what I have changed :)
<= left old one right => new one
如有疑问请评论。
我目前正在尝试将触发器添加到在单个字段上具有多个触发器的表单。
在我的例子中,当 select intetnal 它触发 contenttype 然后它显示 video 或 文章 基于 selection。在完成所有事情后,当我 select external from link 时,它不会触发关闭 contenttype
我正在尝试但没有工作:
link:
label: 'Internal Or External Link'
options:
internal: Internal
external: External
span: full
default: internal
required: 1
type: dropdown
comment: 'Select Link Type'
external_link:
label: 'External Link'
span: full
trigger:
action: show
field: link
condition: 'value[external]'
type: text
comment: 'Enter External Link'
content_type:
label: 'Content Type'
options:
video: Video
article: Article
span: full
trigger:
action: show
field: link
condition: 'value[internal]'
type: dropdown
comment: 'Select Content Type'
videolink:
label: 'Video Link'
span: full
trigger:
action: show
field: content_type
condition: 'value[video]'
type: text
comment: 'Enter Video Link'
article_content:
label: 'Article Content'
size: large
span: full
trigger:
action: show
field: content_type
condition: 'value[article]'
type: richeditor
comment: 'Add Article Content'
嗯,你可以做到,但我们需要确保content_type
在隐藏时清空
所以,我们可以这样做
external_link:
label: 'External Link'
span: full
trigger:
action: hide
field: link
condition: 'value[internal]'
type: text
comment: 'Enter External Link'
content_type:
label: 'Content Type'
emptyOption: -- select a status --
options:
video: Video
article: Article
span: full
trigger:
action: hide|empty
field: link
condition: 'value[external]'
type: dropdown
comment: 'Select Content Type'
我们可以使用 multiple actions
来完成我们的工作。是的,我们还需要为 content_type
添加 emptyOption
以使其为空。
所以当 link
值为 external
时,它将 hide
和 empty
字段 content_type
所以为了那个反应 videolink OR article_content
无法获得它的值,因为 content_type
将是 empty
,所以它们也 hide with that
.
For the sake of simplicity I am putting diff images so you get better idea what I have changed :)
<= left old one right => new one
如有疑问请评论。