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

SchedulerFormCreated Error

3 Answers 103 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Vikram
Top achievements
Rank 1
Vikram asked on 08 Dec 2013, 09:41 PM
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?

3 Answers, 1 is accepted

Sort by
0
Vikram
Top achievements
Rank 1
answered on 09 Dec 2013, 06:22 PM
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?
0
gorp88
Top achievements
Rank 1
Veteran
answered on 10 Jul 2020, 10:26 PM
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.
0
Peter Milchev
Telerik team
answered on 14 Jul 2020, 02:16 PM

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

Tags
Scheduler
Asked by
Vikram
Top achievements
Rank 1
Answers by
Vikram
Top achievements
Rank 1
gorp88
Top achievements
Rank 1
Veteran
Peter Milchev
Telerik team
Share this question
or