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

How do I turn off the confirm dialog?

5 Answers 73 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 17 Jan 2012, 11:17 PM
We are using RadSpell on touch screens and we cannot restyle or override the confirm dialog (pops up after you hit cancel after changing a word) for bigger buttons so I just want to get rid of it.

OnClientCheckCancelled only fires after a selection is made in the confirm dialog and I cannot suppress it this way

Using 
window.confirm = function(msg){} does not work either.
What can I do to address this?

5 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 18 Jan 2012, 08:15 PM
Craig:

You should be able to override the Window.Confirm dialog by using the RadWindowManager and a RadConfirm. This would allow you to customize its look and feel as desired. See the Working with the Confirm Dialog documentation page for insights.

Take a look at Intercept and Manage Windows Originated by Third-party Components Hosted in C# Application for a way to intercept the dialog.

Hope this helps!
0
Craig
Top achievements
Rank 1
answered on 18 Jan 2012, 10:29 PM
I'm not sure I understand you.

I want to be able to remove or replace the confirm dialog in the RadSpell control. It only appears when you change at least 1 word and then cancel the spellcheck.
It looks like this and is identical to the regular javascript confirm dialog

Sample here http://jsfiddle.net/rc8Us/ 


---------------------------------------------------------------------------
|  Message from webpage                                                x  |
---------------------------------------------------------------------------
|                                                                         |
|   ?   Do you want to apply or cancel the changes to the text so far?    |
|                                                                         |
|                                           ----------   ----------       |
|                                           |    OK   |  |  Cancel |      |
|                                           ----------   ----------       |
---------------------------------------------------------------------------


This does not appear to be a RadConfirm and overriding the window.confirm that it looks exactly like does nothing.


0
Richard
Top achievements
Rank 1
answered on 19 Jan 2012, 04:28 PM
Craig:

I've looked at your issue in greater depth. Sorry for the confusion.Here's what I've found.


The only way to achieve your scenario is to Disabling embedded resources, open the SpellDialog.js file and replace the confirm function with true argument in the cancelHandler, e.g.

Original code:
cancelHandler: function()
{
if (this._cancel.disabled)
{
return;
}
//changes will be applied only if spell handler response is received, text has changed
//and the user confirms
this.closeDialog(this._spellProcessor && this._spellProcessor.textChanged() && confirm(this.get_localization()["Confirm"]));


Modified
cancelHandler: function()
{
if (this._cancel.disabled)
{
return;
}
//changes will be applied only if spell handler response is received, text has changed
//and the user confirms
this.closeDialog(this._spellProcessor && this._spellProcessor.textChanged() && true);
}

This should help you achieve your requirement.

Best regards,
0
Craig
Top achievements
Rank 1
answered on 19 Jan 2012, 06:01 PM
Wow, thanks for your indepth response jumpstart!

That looks a bit tricky but I think I may be able to pull it off.

:)

0
Rumen
Telerik team
answered on 23 Jan 2012, 04:41 PM
Hi,

I would propose an easier way to disable the popup and it is to override the cancelHandler function. To do that follow the steps below:

1) Create a JS file named dialog.js in the root of the web application and populate it with the following function:

Telerik.Web.UI.Spell.SpellDialog.prototype.cancelHandler = function (e) {
    if (this._cancel.disabled) {
        return $telerik.cancelRawEvent(e);
    }
    //changes will be applied only if spell handler response is received, text has changed
    //and the user confirms
    this.closeDialog(this._spellProcessor && this._spellProcessor.textChanged() && true);
 
    return $telerik.cancelRawEvent(e);
}

2) Save the file and set the DialogsScriptFile property of RadSpell to point to this file, e.g.

<telerik:RadSpell ID="RadSpell1" runat="server" ControlsToCheck="TextBox1" DialogsScriptFile="dialog.js" />
<asp:TextBox ID="Textbox1" runat="server" />

3) Test the solution.

Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Spell
Asked by
Craig
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Craig
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or