Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
DPrakashRaj
DPrakashRajAccepted solution
Community Advisor
March 10, 2023

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/granite/ui/components/coral/foundation/form/textfield/index.html

6 replies

Rohit_Utreja
Community Advisor
Community Advisor
March 10, 2023

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

Translate
BR, Rohit
hello299Author
Level 2
March 10, 2023

How can we set default value as "" to a textfield?

Translate
Rohit_Utreja
Community Advisor
Community Advisor
March 11, 2023

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

Translate
BR, Rohit
DPrakashRaj
Community Advisor
DPrakashRajCommunity AdvisorAccepted solution
Community Advisor
March 10, 2023

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/granite/ui/components/coral/foundation/form/textfield/index.html

Translate
SantoshSai
Community Advisor
Community Advisor
March 11, 2023

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

Translate
Santosh Sai
Jagadeesh_Prakash
Community Advisor
Community Advisor
March 11, 2023

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

 

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

Translate