since ‎17-11-2020
14 hours ago
Shaheena_Sheikh
Level 1
unable to fetch dropdown value correctly
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I have a component in which i have a multifield item. In each multifield item i have separate containers. In of the containers i have a dropdown. I am trying to fetch the selected value of the dropdown, but i am only getting select as the value with the below code. Whereas if use this code in other components having multifield and dropdown directly as an item in the multifield then i am getting the correct value.My component1-->Tab(Data)-->multifield item1-->container(list)-->container(button)--...

Views

37

Likes

0

Replies

3
Re: Check if new item is added to the multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
thanks, it works!

Views

38

Likes

0

Replies

0
Re: Check if new item is added to the multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
if i add a loop in place of login, the loop never works for the newly added item. $(".coral3-Multifield-item").each(function (index) {console.log("add item");})

Views

27

Likes

0

Replies

0
Re: Loop not working for multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
the above code triggers the console even if i click on a dropdown within multifield, whereas it should trigger only for Add button of multifield. Though the loop issue gets resolved using the above code.

Views

39

Likes

0

Replies

0
Re: Check if new item is added to the multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
this works but has a problem. The alert gets kicked even if i click on a dropdown, colorfield swatch (these are also within multifield items) etc. that should only get triggered for the click event of Add button

Views

56

Likes

0

Replies

0
Re: Loop not working for multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
This is more of a validation. I am doing something like this : https://adapttoaem.blogspot.com/2021/02/setting-dynamic-dropdownselect-value-in.html but only difference is that im using colorfield instead of dropdown in a multifield. So using the above code in JS, when i add a new item to the multifield, a new colorfield is present inside the new item and I need to a run a loop over all the existing items + the new item

Views

41

Likes

0

Replies

0
Loop not working for multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
$(".coral3-Multifield-item").each(function( index ) {}this loop is not working for the newly added items. $("coral-multifield").children("button[coral-multifield-add]").on("click", function() { $(".coral3-Multifield-item").each(function( index ) { console.log("add item"); })});if I already have 2 items in my multifield when I open the dialog, then the above console log prints 2 times. Now if I Add a new item to the multifield (3rd item), the console log still works for the first 2 items only, th...

Views

90

Likes

0

Replies

5
Re: Check if new item is added to the multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
thanks, it works!

Views

56

Likes

0

Replies

0
Re: Check if new item is added to the multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
my func is getting triggered when i am opening the dialog. Not when i click on the Add button

Views

64

Like

1

Replies

0
Check if new item is added to the multifield
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I want to call a JS function when a new item is added to the multifield. I have tried: $(".cq-dialog").find("coral3-Button coral3-Button--secondary").on("click", funcName);doesn't call my function.

Views

138

Likes

0

Replies

9
Re: Granite:id to granite:class
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
i was referring to https://adapttoaem.blogspot.com/2021/02/setting-dynamic-dropdownselect-value-in.html in here, the only difference is that in my case the colorfield is inside a multifield

Views

51

Likes

0

Replies

0
Re: Granite:id to granite:class
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
i pasted the complete function for better understanding. And the first code is not having any multifield

Views

70

Likes

0

Replies

0
Re: Granite:id to granite:class
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
my font-field is within multifield

Views

78

Likes

0

Replies

0
Re: Granite:id to granite:class
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
Parathesis are all in place in my actual code, pasted it wrong here. Console error: Cannot read property 'clear' of undefined for the line where optionItems are getting cleared.

Views

69

Likes

0

Replies

0
Granite:id to granite:class
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
If I replace: const setOptions = function () {let fontField = $(".cq-dialog").find("#fontField ")[0];let optionItems = fontField.items;optionItems.clear();for (var i = 0; i < 1; i++) {let obj = new Object();let cnt = new Object();obj["value"] = "#ffffff";cnt["textContent"] = "white";obj["content"] = cnt;optionItems.add(obj);}};with:const setOptions = function () {$(".coral3-Multifield-item").each(function( index ) {let fontField = $(this).find(".fontField ");var arah=["#ffffff","#000000",""];var...

Views

136

Likes

0

Replies

9
Re: Disabling a field in dialog
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
Yes, I am using JS to make my field readOnly. Thanks for the info.

Views

70

Likes

0

Replies

0
Re: Disabling a field in dialog
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
thanks! fontField.readOnly=true; works

Views

90

Likes

0

Replies

0
Re: Disabling a field in dialog
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I updated 'let' to 'var' and it's still the same 😞

Views

55

Likes

0

Replies

0
Disabling a field in dialog
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I have the below code:let fontField = $(".cq-dialog").find("#contentColor")[0];fontField.value="#ffffff";fontField.disabled=true; the colorfield shows #ffffff and as disabled. But after closing the dialog, I don't see the color of the font as white (#ffffff). If I comment the line of code having disabled, the color starts reflecting. If i comment the third line of code, the value for the colorfield gets stored in the node but if I don't comment the third line then the value doesn't get stored at...

Views

122

Likes

0

Replies

6
Re: ID for a field in multified
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
so, if I have 4 multifield items how can i get the data for each textfield in each item?

Views

121

Likes

0

Replies

0
ID for a field in multified
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I have a textfield within a multified. I need to fetch the ID for the textfield each item a new multified item is added. Since the textfield is within the multified I am not sure how can i set the granite:id to it. Any suggestion?

Views

166

Likes

0

Replies

5
loading clientlib for dialog
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I have a clientlib with 3-4 js files in it in a component. I wanted 1 of those JS files to load for my dialog. I cant use extraClientlibs because that way all the JS will load for my dialog, whereas I specifically want only 1 particular file to load for my dialog. Is there a way to do this?

Views

145

Likes

0

Replies

4
Refresh page after editing component
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I have a component with various fields in it along with image field. I want to refresh the page only when the image field is update. Right now I'm using edit:config to refresh page "afteredit". How can I refresh the page only when the image field is edited?

Views

176

Likes

0

Replies

5
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
thanks for the solution. I too found another way of dealing with it. I am removing/adding the ID everytime theres a validation to keep only a single alert.

Views

131

Likes

0

Replies

0
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
updated the code snippet and the problem statement.

Views

144

Likes

0

Replies

0
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
i am trying to use coral-alert instead of window.alert. But the problem is, the alert is getting added to the entire page instead of the dialog and is not even clearly visible

Views

155

Likes

0

Replies

0
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
yes, coral alert would help. But i am not sure how i can add this to my JS

Views

125

Likes

0

Replies

0
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I am not necessarily looking for field descriotion, but i only want to prompt the user with a msg that they using wrong color, and dont even want to prevent them from using the wrong color.

Views

103

Likes

0

Replies

0
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
this will hide the entire color field, whereas i only want to hide field description of the colorfield

Views

107

Likes

0

Replies

0
Re: Add field description property dynamically to the dia...
Avatar

Shaheena_Sheikh

Shaheena_Sheikh
- Adobe Experience Manager
I dont want to add the return msg, because this will not let the user save the dialog if there's a wrong color chosen and it will force them to correct the colour. But i dont want to force the user to correct the value. I only want to give them a msg through field description that they have chosen a wrong color and then let them save the wrong value if they want.

Views

178

Likes

0

Replies

0
Likes from