How do I turn off the confirm dialog?

6 posts, 0 answers
  1. Craig
    Craig avatar
    6 posts
    Member since:
    Jan 2012

    Posted 17 Jan 2012 Link to this post

    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?
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 18 Jan 2012 Link to this post

    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!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Craig
    Craig avatar
    6 posts
    Member since:
    Jan 2012

    Posted 18 Jan 2012 Link to this post

    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.


  5. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 19 Jan 2012 Link to this post

    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,
  6. Craig
    Craig avatar
    6 posts
    Member since:
    Jan 2012

    Posted 19 Jan 2012 Link to this post

    Wow, thanks for your indepth response jumpstart!

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

    :)

  7. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 23 Jan 2012 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017