Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

defaultValue in Touch UI dialogs - AEM/CQ

Tags:

aem

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)

like image 774
Sandeep Kumar Avatar asked Jul 28 '16 15:07

Sandeep Kumar


People also ask

What is the node name we give to create a touch UI dialog in AEM?

While creating dialog for Touch UI, we are creating nodes in the name of cq:dialog, content, layout etc via "Create node" unlike an option named "Create dialog" for classic view.


1 Answers

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">
like image 141
Emin Can Sümer Avatar answered Sep 23 '22 12:09

Emin Can Sümer