Skip to main content
Adobe Employee
Aug 9, 2021 2:56 PM UTC
Solved

How set property value of textfield using sightly?

How set property value of textfield using sightly? or how to add the page title as property value in text field?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
Community Advisor
Aug 9, 2021 3:06 PM UTC

HI @keerthana_h_n 

 

You want to add/show the default value when the value is not authored in dialog for a field?

You can use below approach:

 

${properties.pageTitle || properties.jcr:title}

So if the pageTitle is not authored it will pick the jcr:title as the default value.

 

Thanks! 

7 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
Aug 9, 2021 3:06 PM UTC

HI @keerthana_h_n 

 

You want to add/show the default value when the value is not authored in dialog for a field?

You can use below approach:

 

${properties.pageTitle || properties.jcr:title}

So if the pageTitle is not authored it will pick the jcr:title as the default value.

 

Thanks! 

Translate
Adobe Employee
Aug 9, 2021 3:09 PM UTC

Hi @asutosh_jena_

 

I need to display the page title in my dialog textfield as default. How can that be achieved?

Translate
Adobe Employee
Aug 10, 2021 6:57 AM UTC

Hi @asutosh_jena_ 

 

To populate description in text field we do samething? bcz I tried to populate description similar way showing undefined.

Translate
Asutosh_Jena_
Community Advisor
Community Advisor
Aug 10, 2021 7:03 AM UTC

Hi @keerthana_h_n 

 

You can read the description from metatag using the below command:

$('meta[name=description]').attr('content');

Now this value can be assigned the the respective field using the required selector (ensure correct name or id attribute is used to update the respective field).

 

Thanks!

Translate