根据木兰内容应用程序中的下拉值隐藏字段 [英] Hide Fields Based on dropdown value in Magnolia content app
本文介绍了根据木兰内容应用程序中的下拉值隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发类似于Tours的内容应用程序.在这种情况下,我有一个包含多个字段的表单.
现在,我有一个要求,例如 http://jsfiddle.net/5SArB/1911/小提琴.
我需要根据下拉菜单中的选择隐藏一些字段,例如当年龄超过18岁时如何隐藏父级详细信息.
enter code here
I am developing a content app similar to Tours. In this I have a form that has multiple fields.
Now i have a requirement like http://jsfiddle.net/5SArB/1911/ fiddle.
I need to hide few fields based on the selection from dropdown like how parent details hidden when age is more than 18 .
How to achieve this in magnolia content app?enter code here
推荐答案
这应该是您在Magnolia 5.7中使用的语言.
This should be your yaml in Magnolia 5.7.
您应该结合使用可切换字段和 composite 字段:
You should use the switchable field combined with composite field:
wide: true
form:
tabs:
- name: tabForm
label: Form registration
fields:
- name: username
label: Name
fieldType: text
- name: email
label: Email
fieldType: text
- name: ageConfig
fieldType: switchable
label: Age
selectionType: select
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
type: String
options:
- name: young
label: 18 or younger
value: young
- name: old
label: 19 or older
value: old
fields:
- name: young
fieldType: composite
label: ''
layout: vertical
fields:
- name: parentName
fieldType: text
label: Parent name
- name: parentMail
fieldType: text
label: Parent email
- name: old
fieldType: hidden
actions: !include:/my-project/dialogs-common/actions-block.yaml
这是年轻"的情况:
这是旧"情况:
这篇关于根据木兰内容应用程序中的下拉值隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文