This is a migrated thread and some comments may be shown as answers.

Show confirmation window on Cancel

3 Answers 221 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
MBEN
Top achievements
Rank 2
Veteran
MBEN asked on 29 Aug 2016, 10:10 PM
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?

3 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 01 Sep 2016, 01:19 PM
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
0
Johnathan
Top achievements
Rank 1
answered on 09 Dec 2016, 04:41 PM

Hi Peter,

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

Thanks,

Johnathan Beam

0
Peter Milchev
Telerik team
answered on 13 Dec 2016, 03:02 PM
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.
Tags
Wizard
Asked by
MBEN
Top achievements
Rank 2
Veteran
Answers by
Peter Milchev
Telerik team
Johnathan
Top achievements
Rank 1
Share this question
or