Expand my Community achievements bar.

SOLVED

Get PathBrowser Value

Avatar

Level 5

Hi all,

 

keerthana_hn_0-1620889961350.png

I've created a button component and given resourceType "core/wcm/components/form/button/v2/button". I have added dialog to my component because an extra field was supposed to be added (Path Browser). I need to get the path browser value given in dialog box in js file. How can I do that? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Community Advisor

Hi @keerthana_hn 

 

You want to read the path browser value from dialog field and perform some operation in JS which is located on clientlib.

So you need to read the field value and put it as a hidden value in HTML (put as hidden only if it's not required to be shown on page else you can attach to any attribute)

 

Now using the id or class attribute you can read the value and perform any action.

 

Let's say I have the node name as ./templatePath in the path browser and want to keep it as an hidden value in page.

<div class="hide" id="somevalue">${properties.templatePath}</div>

now in js:

var x = $("#somevalue").text();

x holds the value of the pathfield which is authored in dialog.

 

Thanks!

Avatar

Level 5

@Asutosh_Jena_ 

 

keerthana_hn_0-1620893222421.png

<div class="hide" id="file_report_template">${properties.templatePath}</div>

I added this to my htl file and not able to hide the value

Avatar

Community Advisor

@keerthana_hn Which framework are you using? Is it bootstrap 3 or bootstrap 4?

 

If you are using bootstrap 3 the class will be "hide".
if it's bootstrap 4 the class will be "d-none".

 

If no framework is used, you can add any class and apply the css style to it.

 

Let's say you use class as "hide". Then in css add the below property:

 

hide {

display: none;

}

Avatar

Correct answer by
Community Advisor

Hi, It seems you are extending core components.

Please follow the below article to check how to extend core components

https://helpx.adobe.com/experience-manager/using/extend_jave_corecomponents.html

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/extending-the-listitems-of...

 



Arun Patidar