Show confirmation window on Cancel

4 posts, 0 answers
  1. MBEN
    MBEN avatar
    174 posts
    Member since:
    Nov 2011

    Posted 29 Aug 2016 Link to this post

    In my wizard, i want to pop up a confirmation window if the user clicks cancel button. If the user confirms (yes) then i want to cancel the wizard processing and go to my home page else continue on the same page. is it possible?
  2. Peter Milchev
    Admin
    Peter Milchev avatar
    282 posts

    Posted 01 Sep 2016 Link to this post

    Hello,

    You could subscribe to the OnClientButtonClicked event and if the clicked button is Cancel, then you should show your confirmation window. Here is a sample implementation of the approach:

    <script>   
        function OnClientButtonClicked(sender, args) {
            var command = args.get_command();
            // if cancel button is clicked
            if (command == "3") {
                // Your custom confirmation logic here
            }
        }
    </script>

    <telerik:RadWizard ID="RadWizard1" runat="server" DisplayCancelButton="true" OnClientButtonClicked="OnClientButtonClicked">
        <WizardSteps>
            <%-- Steps here --%>
        </WizardSteps>
    </telerik:RadWizard>

    Regards,
    Peter Milchev
    Telerik by Progress
  3. Johnathan
    Johnathan avatar
    39 posts
    Member since:
    Sep 2012

    Posted 09 Dec 2016 in reply to Peter Milchev Link to this post

    Hi Peter,

    Can you provide the necessary JS code to cancel a wizard finish button click using the OnClientButtonClicked event?

    Thanks,

    Johnathan Beam

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    282 posts

    Posted 13 Dec 2016 Link to this post

    Hello Johnathan,

    To prevent the clicking event, the ButtonClicking event should be utilized and the args.set_cancel(true) method should be called. The args.get_command() method returns wizard commands corresponding to the following integers:
    • 0 - WizardCommand.Previous;
    • 1 - WizardCommand.Next;
    • 2 - WizardCommand.Finish;
    • 3 - WizardCommand.Cancel;
    • 4 - WizardCommand.NavigationBarButtonClick;
    Based on that information, the OnClientButtonClicking event handler should be similar to the following:

    function OnClientButtonClicking(sender, args) {
        // Cancel click event if Finish button is clicked
        if (args.get_command() === 2) {
            args.set_cancel(true);
        }
    }

    Regards,
    Peter Milchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top