When a user wants to change a value,
I want to alert the user on javascript.
based on the user respone, I want to stop the change of the from happening.
so on the event SelectionChanging, i put the following function.
function SelectionChanging() {
var answer = confirm("Procceed?") if (answer) { return true; } return false; }
But the value still changes, even if the user chooses no.
Hello drpoalim,
If you have any further questions, regarding this matter please feel free to contact me.
Sincerely,
Tsanna
Thank you for posting in our community.
In order to stop firing the SelectionChanged event, you need to cancel the SelectionChanging event of proceeding through the event arguments. Generally you need to modify the SelectionChanging function like the following:
function WebDropDown1_SelectionChanging(sender, eventArgs) {
var selectedItemChanging = confirm("Proceed?");
if (selectedItemChanging==true) {
eventArgs.set_cancel(false);
}
else {
eventArgs.set_cancel(true);
Attached is also a sample illustrating similar scenario for your reference. Please let me know if this helps you.