"" value to a field if it is not authored | Community
Skip to main content
New Participant
March 10, 2023
Solved

"" value to a field if it is not authored

  • March 10, 2023
  • 4 replies
  • 1265 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by DPrakashRaj

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

4 replies

Jagadeesh_Prakash
New Participant
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 '"';
}

SantoshSai
New Participant
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

Santosh Sai
DPrakashRaj
DPrakashRajAccepted solution
New Participant
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

Rohit_Utreja
New Participant
March 10, 2023

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

hello299Author
New Participant
March 10, 2023

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

Rohit_Utreja
New Participant
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