AEM 6.3 - Coral Select List, How to get previously selected value on change event. | Community
Skip to main content
ankushj18225577
June 28, 2018
Solved

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

  • June 28, 2018
  • 1 reply
  • 1193 views

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.
Best answer by arunpatidar

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

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
June 28, 2018

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