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
emptyText
- But this is kind of placeholder text. If user wants to save form without entering value, this is not useful.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)
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">