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

Modify dialog value after dialog submission in AEM

Avatar

Avatar
Validate 1
Level 3
Anderson_Hamer
Level 3

Likes

13 likes

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 3
Anderson_Hamer
Level 3

Likes

13 likes

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
Anderson_Hamer
Level 3

26-08-2020

We want to get the input from page dialog(multifield) and add some prefix string(hardcode) before store the value in node. like /hardcodevalue/{dialogvalue} and store the value in node. Can we use any listeners to do this or what is the approach that should follow? please share any reference.

Replies

Avatar

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

243 likes

Total Posts

256 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

243 likes

Total Posts

256 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
Nikhil-Kumar
MVP

26-08-2020

@Anderson_Hamer 

You can use the Coral UI to get the Multifield data in Jquery and calling a servlet from the same Jquery where you can use the node api to save the modified data on the same multifield resource.

The listener that will help you will be $(document).on(“click”, “.cq-dialog-submit”, function(e) 

Please refer CoralUI in AEM
to get the multifield data in Jquery using CoralUI


Hope this procedure helps!!

Thanks,
Nikhil




Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,228 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,228 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

26-08-2020

If you will save the values on different place that means at /hardcodevalue/{dialogvalue} then you may face problem while retrieving values when dialog will be opened for editing again.

What is your use case?

Avatar

Avatar
Validate 1
Level 3
Anderson_Hamer
Level 3

Likes

13 likes

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 3
Anderson_Hamer
Level 3

Likes

13 likes

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
Anderson_Hamer
Level 3

09-11-2020

No, I am not string the value in different location. same place with hard coded prefix value.

Avatar

Avatar
Validate 1
Level 3
Anderson_Hamer
Level 3

Likes

13 likes

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 3
Anderson_Hamer
Level 3

Likes

13 likes

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
Anderson_Hamer
Level 3

09-11-2020

Can this be done without a servlet ? there is no complex in backend. just want to prefix some hard coded value /hardcodevalue/{dialogvalue}

Avatar

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

274 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

274 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Anudeep_Garnepudi
MVP

09-11-2020

Hi @Anderson_Hamer 

I would suggest create a hidden field in the dialog(granite/ui/components/coral/foundation/form/hidden) and set the value before submitting the dialog.

AG

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

139 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

139 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

09-11-2020

Hi @Anderson_Hamer 

You can achieve this with dialog listeners, please refer below code for the same.

 

Dialog field : 

<textInput
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="Configure Text"
fieldLabel="Text"
granite:class="concat-txt-input"
name="./textInput"/>

 

Add listener js code with clientlib category mentioned below :

(function ($, $document) {
"use strict";
$(document).on("click", ".cq-dialog-submit", function (e) {
var $concatTextInput = $('.concat-txt-input');
var $inputVal = $concatTextInput.val();

if($inputVal.val()){
var prefix = '/hardcodevalue/';
$concatTextInput.val(prefix+$inputVal); //before submit concatenate input value with prefix
}
});
})($, $(document));
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="cq.authoring.dialog"/>

 

Hope this helps!