Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3550
Stop value changing
posted

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.

I also want to stop server event, of valuechanged/selectionchanged from happening
Parents
  • 15320
    Verified Answer
    Offline posted

    Hello drpoalim,

    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.

     

     

    Sincerely,

    Tsanna

     

    WebDropDownSelectionChanging.zip
Reply Children
No Data