Expand my Community achievements bar.

SOLVED

"" value to a field if it is not authored

Avatar

Level 2

Is there any  wayto add "" (Doubles quotes) value to textfield if the field is not authored?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Yes you can use any value even "" as default value with the

<title
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    fieldLabel="Title"
    name="./title"
    value=""/>

 

https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/...

View solution in original post

6 Replies

Avatar

Community Advisor

@hello299 ,
Could you please share the use-case for this scenario?

Avatar

Community Advisor

Hi @hello299 

 

Default value can be set in the textfield node by setting a property value as "".

You can check the details of all supported properties at "/libs/granite/ui/components/coral/foundation/form/textfield/render.jsp".

 

I hope, it helps.

Thanks

Avatar

Correct answer by
Community Advisor

Yes you can use any value even "" as default value with the

<title
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    fieldLabel="Title"
    name="./title"
    value=""/>

 

https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/...

Avatar

Community Advisor

Hi @hello299 ,

Yes! You can achieve that, kindly refer below snippet.

 

<demo
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    fieldLabel="Demo"
    name="./demo"
    value="&quot;&quot;"/>

 

This will help you to pre-set value in dialog, additionally you can set it in many different way eg.

  • cq:template
  • Sling Model

Hope that helps!

Regards,

Santosh

Avatar

Community Advisor

@hello299  If none of the mentioned solutions are not working. Write a script which will set the value to "" 

 

if (isEmpty(value)) {
return '"';
}