Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM 6.3 - Coral Select List, How to get previously selected value on change event.

Avatar

Level 1

I have a progressive drop down in my dialog. My requirement is to get previously selected value on change event.

Basically, I want's to show confirmation box to the user only if he selected a different value. And if the user clicks on the cancel button, the previous value should be automatically selected.

Demo : Dropbox - Jun-28-2018 12-32-23.mp4 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You can do this by using jquery, below is the sample code snippet to get previous value  from dropdown

(function () {
  
var previous;

  $
("select").on('focus', function () {
  
// Store the current value on focus and on change
  previous
= this.value;
  
}).change(function() {
  
// Do something with the previous value after the change
  alert
(previous);

  
// Make sure the previous value is updated
  previous
= this.value;
  
});
})();

Thanks

Arun



Arun Patidar

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

You can do this by using jquery, below is the sample code snippet to get previous value  from dropdown

(function () {
  
var previous;

  $
("select").on('focus', function () {
  
// Store the current value on focus and on change
  previous
= this.value;
  
}).change(function() {
  
// Do something with the previous value after the change
  alert
(previous);

  
// Make sure the previous value is updated
  previous
= this.value;
  
});
})();

Thanks

Arun



Arun Patidar