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

how to make tooltip as mandatory field in the Image Manager

3 Answers 88 Views
Editor
This is a migrated thread and some comments may be shown as answers.
lan
Top achievements
Rank 1
lan asked on 28 Sep 2010, 09:51 PM
Hi Telerik team,

In our application, we want to force users to fill the tooltips in the Image manager and link manager. The link manager is pretty straightforward I just changed the code in the LinkManager.axcx ( see following )

_insertClickHandler:

function(e)

 

{

 

    var modifiedLink = this.getModifiedLink();

 

 

 

    if (modifiedLink.title != "") {

 

 

        var args = new Telerik.Web.UI.EditorCommandEventArgs("LinkManager", null, modifiedLink);

 

 

        //backwards compatibility

 

        args.realLink = modifiedLink;

 

        Telerik.Web.UI.Dialogs.CommonDialogScript.get_windowReference().close(args);

    }
    //added codes here
   

 else {

 

        alert(

'please fill the Tooltip field');

 

        $telerik.cancelRawEvent(e);

    }

},

But in the ImageManager.axcx, I cannot find the same method. I checked the code and I found the SetImageProperties.axcx have the same method but the method is not added to the insert button event handler.

Please help me out here.

Thanks

3 Answers, 1 is accepted

Sort by
0
lan
Top achievements
Rank 1
answered on 29 Sep 2010, 06:46 PM
Any solution?
0
Accepted
Dobromir
Telerik team
answered on 30 Sep 2010, 01:47 PM
Hi lan,

ImageManager is a complex dialog that contains several different components. The Insert and Cancel buttons are part of the FileBrowser dialog and their click handlers are registered in the FileManager class. In order to achieve the required result you need to override the handler for the specific dialog. For example, if you want to modify ImageManager dialog's Insert button click to pop-up an alert message if not Alt text is set you need to add the following code in the ImageManager.ascx:
Telerik.Web.UI.Widgets.FileManager.prototype._insertClickHandler = function (e)
{
    var selectedItem = this.get_selectedItem();
    if (selectedItem && selectedItem.get_type() == Telerik.Web.UI.FileExplorerItemType.File)
    {
        var result = this._filePreviewer.getResult();
 
        if (result.getAttribute("alt") && result.getAttribute("alt") != "")
        {
            var previewer = this.get_previewerType();
            var commandName = previewer ? previewer.replace("Previewer", "Manager") : "FileBrowser";
            var args = new Telerik.Web.UI.EditorCommandEventArgs(commandName, null, result);
            window.setTimeout(
            function ()
            {
                Telerik.Web.UI.Dialogs.CommonDialogScript.get_windowReference().close(args);
            }, 0);
        }
        else
        {
            alert("You must set Alt Text");
        }
    }
}

Please note that the FileManager's _insertClickHandler method is shared between all the Manager dialogs.

Kind regards,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
lan
Top achievements
Rank 1
answered on 30 Sep 2010, 02:57 PM
It works! Thanks a lot!
Tags
Editor
Asked by
lan
Top achievements
Rank 1
Answers by
lan
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or