AEM 6.3 - Coral Select List, How to get previously selected value on change event. | Community
Skip to main content
ankushj18225577
New Participant
Jun 28, 2018 7:05 AM UTC
Solved

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

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Jun 28, 2018 7:56 AM UTC

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

1 reply

arunpatidar
arunpatidarAccepted solution
New Participant
Jun 28, 2018 7:56 AM UTC

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

Translate
Arun Patidar