defaultValue in Touch UI dialogs - AEM/CQ

寵の児 提交于 2019-12-01 18:30:14

问题


For classic UI there is a option to set defaultValue for fields, this is shown to user when user first time opens the dialog after dragging the component. If user clears the value in dialog and saves, on editing the dialog, value of field is not shown again.

For touch UI dialog, couldn't find the equivalent of defaultValue. There are following options

  1. emptyText - But this is kind of placeholder text. If user wants to save form without entering value, this is not useful.
  2. value - This shows the value when first time component is opened for authoring. But if user clears the value and saves. From the JCR structure the value is removed. But if user opens the dialog for editing, the value is again shown in the field, while this should be empty.

If there a equivalent of defaultValue in touch UI dialog or any other way of handling this (may be listeners or something else)


回答1:


Instead of using defaultValue or value, I feel like you should be using cq:template node. You can achieve this by adding nt:unstructured type of node with cq:template name under the component. Like this:

_cq_template/.content.xml

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
    xmlns:jcr="http://www.jcp.org/jcr/1.0"
    xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="nt:unstructured"
    sampleProperty="Default value of sampe property">



回答2:


I'm planning to set a select field in the design dialog with dropdown for default values and then work with it in the cq-dialog with value="${cqDesign.type}"



来源:https://stackoverflow.com/questions/38640339/defaultvalue-in-touch-ui-dialogs-aem-cq

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!