SchedulerFormCreated Error

4 posts, 0 answers
  1. Vikram
    Vikram avatar
    11 posts
    Member since:
    Oct 2010

    Posted 08 Dec 2013 Link to this post

    Hi,

    I had tried to show Advanced Form using Advanced Templates exactly.

    But when I try to open Advanced Form for new appointment, the All day checkbox is not working. Even the DatePicker and TimePicker controls are not working.

    Chrome console display following as error - 

    Uncaught TypeError: Cannot read property 'EventScheduler_3' of undefined
    1. SchedulerFormCreatedDefault.aspx:102
    2. Telerik.Web.UI.RadWebControl.raiseEventTelerik.Web.UI.WebResource.axd:825
    3. c.RadScheduler._raiseFormCreatedTelerik.Web.UI.WebResource.axd:7117
    4. c.RadScheduler._fireFormCreatedTelerik.Web.UI.WebResource.axd:6247
    5. c.RadScheduler._initializeAdvancedTemplateTelerik.Web.UI.WebResource.axd:5853
    6. Sys._Application.raiseLoadTelerik.Web.UI.WebResource.axd:6
    7. Sys.WebForms.PageRequestManager._pageLoadedTelerik.Web.UI.WebResource.axd:15
    8. Sys.WebForms.PageRequestManager._scriptsLoadCompleteTelerik.Web.UI.WebResource.axd:15
    9. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    10. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    11. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    12. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    13. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    14. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    15. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    16. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    17. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    18. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    19. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    20. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    21. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    22. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    23. Sys._ScriptLoader._nextSessionTelerik.Web.UI.WebResource.axd:15
    24. Sys._ScriptLoader._loadScriptsInternalTelerik.Web.UI.WebResource.axd:15
    25. Sys._ScriptLoader._scriptLoadedHandlerTelerik.Web.UI.WebResource.axd:15
    26. Sys._ScriptLoaderTask._scriptLoadHandlerTelerik.Web.UI.WebResource.axd:6
    27. b

    The following is the client side event handler for OnClientFormCreated

    //<![CDATA[
            // Dictionary containing the advanced template client object
            // for a given RadScheduler instance (the control ID is used as key).
            var schedulerTemplates = {};
     
            function SchedulerFormCreated(scheduler, eventArgs)
            {
                // Create a client-side object only for the advanced templates
                var mode = eventArgs.get_mode();
                 
                if (mode == window.Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||mode == window.Telerik.Web.UI.SchedulerFormMode.AdvancedEdit)
                {
                    // Initialize the client-side object for the advanced form
                    var formElement = eventArgs.get_formElement();
                    var templateKey = scheduler.get_id() + "_" + mode;
     
                    var advancedTemplate = schedulerTemplates[templateKey];                
     
                    if (!advancedTemplate)
                    {
                        // Initialize the template for this RadScheduler instance
                        // and cache it in the schedulerTemplates dictionary
                        var schedulerElement = scheduler.get_element();
                        var isModal = scheduler.get_advancedFormSettings().modal;
                        advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement, isModal);
                        advancedTemplate.initialize();
     
                        schedulerTemplates[templateKey] = advancedTemplate;
     
                        // Remove the template object from the dictionary on dispose.
                        scheduler.add_disposing(function ()
                        {
                            schedulerTemplates[templateKey] = null;
                        });
                    }
     
                    // Are we using Web Service data binding?
                    if (!scheduler.get_webServiceSettings().get_isEmpty())
                    {
                        // Populate the form with the appointment data
                        var apt = eventArgs.get_appointment();
                        var isInsert = mode == window.Telerik.Web.UI.SchedulerFormMode.AdvancedInsert;
                        advancedTemplate.populate(apt, isInsert);
                    }
                }
            }
     
            //]]>

    The bold part in code is the line where this error occurs. And I believe this could be the possible reason for unexpected behavior of Advanced Form.

    Can you share with me how I can get rid of this error?
  2. Vikram
    Vikram avatar
    11 posts
    Member since:
    Oct 2010

    Posted 09 Dec 2013 Link to this post

    Cause of Problem -

    I was using following markup to refer scripts -

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Path="AdvForm/AdvancedForm.js" />
                <asp:ScriptReference Path="Script/jquery-1.4.3.min.js" />
            </Scripts>
        </telerik:RadScriptManager>

    Solution - 

    I believe jQuery is loading later and SchedulerFormCreated is executed earlier. So I tried with below way and it worked smoothly.

    <head>
        <link rel="stylesheet" type="text/css" href="Style/Style.css" />
        <script type="text/javascript" src="Script/jquery-1.4.3.min.js"></script>
    </head>

    But I still want to know why RadScriptManager method failed?
  3. gorp88
    gorp88 avatar
    3 posts
    Member since:
    Jul 2020

    Posted 10 Jul 2020 in reply to Vikram Link to this post

    Radscheduler is not binding to the client side event  schedulerFormCreated. This only happens when the DLL is updated to the 2020 version. It works fine in older versions. Is there a proper solution for this case.
  4. Peter Milchev
    Admin
    Peter Milchev avatar
    880 posts

    Posted 14 Jul 2020 Link to this post

    Hello gorp88,

    Most probably there is a JavaScript error in the browser's console that will give you more information on why this is happening. 

    Another option is if there are some script files that are not loaded on the client-side. To check that, inspect the failing requests in the Network tab of the DevTools(F12) as explained below:

    Regards,
    Peter Milchev
    Progress Telerik

Back to Top