Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Get PathBrowser Value

keerthana_hn
Level 3
Level 3

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
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor
4 Replies
asutosh_jena
Community Advisor
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!

keerthana_hn
Level 3
Level 3

@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

asutosh_jena
Community Advisor
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;

}

Arun_Patidar
Correct answer by
Community Advisor
Community Advisor