error 'ResetForm' is undefined Master page scenario

5 posts, 1 answers
  1. Chris @ Intrinsic
    Chris @ Intrinsic avatar
    98 posts
    Member since:
    Oct 2010

    Posted 21 Mar 2011 Link to this post

    Loading a script within a Master page does not work at all.  I get the following error from IE7 when loading the page:

    error: 'ResetForm'  is undefined
    Code: 0
    URL: http://localhost:.........

    In the master page is the following code

    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
                <asp:ScriptReference Path="~/Scripts/common.js"  />

    The script file (common.js) is:
    function ResetForm(sender, eventArgs) {
        return false;

    I am thinking that the masterpage is loaded after the content. so, in that case why is there a script manager
    in the master page?? Or should I be loading my script in the content page?? I haven't seen an answer to this
    seemingly common problem anywhere.

    thank you!

  2. Chris @ Intrinsic
    Chris @ Intrinsic avatar
    98 posts
    Member since:
    Oct 2010

    Posted 21 Mar 2011 Link to this post

    I've found that maybe it's my script that I'm using thats the problem? 

    I've used a radconfirm substitute as follows:
    //Replace old radconfirm with a changed version.   
    var oldConfirm = radconfirm;
    //window.radconfirm = function(text, mozEvent)
    //change the radconfirm function so it takes all the original radconfirm attributes
    window.radconfirm = function (text, mozEvent, oWidth, oHeight, callerObj, oTitle) {
        var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually    
        //Cancel the event   
        ev.cancelBubble = true;
        ev.returnValue = false;
        if (ev.stopPropagation) ev.stopPropagation();
        if (ev.preventDefault) ev.preventDefault();
        //Determine who is the caller   
        var callerObj = ev.srcElement ? ev.srcElement :;
        //Call the original radconfirm and pass it all necessary parameters   
        if (callerObj) {
            //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.   
            var callBackFn = function (arg) {
                if (arg) {
                    callerObj["onclick"] = "";
                    if (; //Works fine every time in IE, but does not work for links in Moz   
                    else if (callerObj.tagName == "A") //We assume it is a link button!   
                        try {
                        catch (e) { }
            //oldConfirm(text, callBackFn, 300, 100, null, null);       
            oldConfirm(text, callBackFn, oWidth, oHeight, callerObj, oTitle);
        return false;

    So, the above script is the script that's not getting loaded, but the other ResetForm script is getting loaded just fine.  so, for some reason I can't load the above radconfirm substitute script in the master page.  How exactly would I load it properly in the master page, or as a last resort, just load it in every content page that needs it?  And, what is the best practice? (to load all js scripts in the master page or to load in content pages or?)  also, if I just copy the above script directly into the content page, the radconfirm script works perfectly.

    thank you.

  3. Chris @ Intrinsic
    Chris @ Intrinsic avatar
    98 posts
    Member since:
    Oct 2010

    Posted 21 Mar 2011 Link to this post

    Ok, I've fixed that problem.  But, now what if I don't want to hardcode 25 different confirm messages??  How exactly would I pass the string for the dialog message, and also the title of the dialog to the radconfirm function above?  I would prefer complete documentation on the clientside reference for the suite of telerik controls if possible.    Also, what if I wanted to change the text size on the dialog box and other details of the radconfirm function above?


  4. Chris @ Intrinsic
    Chris @ Intrinsic avatar
    98 posts
    Member since:
    Oct 2010

    Posted 21 Mar 2011 Link to this post

    I've managed to pass in my parameters to the radconfim function which are  the dialog text, and the title.  And that is working.  (Even though there is no documentation whatsoever on this, which is slowing my progress to a crawl!).  But, of course, the title doesn't show up on the radconfirm dialog now.  Why is that?  the dialog text shows up fine, but no title on the radconfirm dialog.

    My Onclientclicked event of the RadButton is as follows:

    OnClientClicked="function (button,args){OpenConfirm('<h3 style=\'color: #333399;\'>Are you sure?</h3>','Delete');}"

    OpenConfirm function I wrote (because you can't call radconfirm directly as the parameters seem to screw up my entire page.):
    function OpenConfirm(dialogtext, title) {
        return radconfirm(dialogtext, event, 330, 180, title);

    why is there no title displaying on the dialog box now??

    There is no documentation on the radbutton, or onclientclicked event.  Where is the documentation and complete explanation for this??

  5. Answer
    Pero avatar
    1156 posts

    Posted 23 Mar 2011 Link to this post


    Please excuse us for the inconvenience, we will soon upload new articles to our online documentation that explain how to work with the RadButton's client-side events.
    The radconfirm function takes up to 6(six) parameters as shown here:
    radconfirm(text, callBackFn, oWidth, oHeight, callerObj, oTitle).
    Since, you don't pass a callerObj, you could pass null before the title argument.

    The following example from our online demos shows how to confirm the postback with RadButton and different confirm dialogs: confirm postback demo.
    We have recently uploaded a project to our Code Library that shows different ways to pass parameters to the client-side event handlers of the button. Here is a link to it: passing parameters demo.

    the Telerik team
Back to Top