Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Scheduler > Pressing enter key in advanced form lost focus

Not answered Pressing enter key in advanced form lost focus

Feed from this thread
  • Antony avatar

    Posted on Jan 20, 2012 (permalink)

    I was testing my own built RADScheduler page and I found a bug.
    My page will always start an advanced form to insert, when I press the Enter key, the focus dissappeared.

    In my masterpage I have a Log Out button. Every time when I press the Enter key, I get logged out. How can I get the focus on the advanced insert form?

    In my advanced form I have one custom attribute.

    This problem also happens with the demo RADScheduler page. I use Internet Explorer 9 to test it. 

    I don't have any code in Javascript or in the CS file:

    <telerik:RadScheduler AppointmentStyleMode="Default" Culture="nl-NL" EnableCustomAttributeEditing="True"
            DataDescriptionField="omschrijving" DataEndField="eindtijd" DataKeyField="OID"
            DataRecurrenceField="terugkeerRegel" DataRecurrenceParentKeyField="terugkeerOID"
            DataSourceID="ldeAgenda" DataStartField="starttijd" DataSubjectField="onderwerp"
            DayEndTime="19:00:00" DayStartTime="07:00:00" EditFormTimeFormat="H:mm" EnableDescriptionField="True"
            FirstDayOfWeek="Monday" Height="" HoursPanelTimeFormat="H:mm" ID="rsrAgenda"
            CustomAttributeNames="locatie" LastDayOfWeek="Sunday" OnFormCreated="Schedule_FormCreated"
            <%--OnAppointmentInsert="InsertAfspraak" OnAppointmentDelete="DeleteAfspraak" OnAppointmentUpdate="UpdateAfspraak"--%>
            runat="server" SelectedView="MonthView" StartInsertingInAdvancedForm="True" WorkDayEndTime="19:00:00"
            WorkDayStartTime="07:00:00">
            <AdvancedForm Modal="true" TimeFormat="H:mm" />
            <TimelineView GroupingDirection="Vertical" />
            <MonthView GroupingDirection="Horizontal"></MonthView>
            <DayView EnableExactTimeRendering="True" />
            <AppointmentContextMenuSettings EnableDefault="true" EnableEmbeddedSkins="True" />
            <AdvancedForm Modal="true" ZIndex="2000000" />
            <TimeSlotContextMenuSettings EnableEmbeddedSkins="True" />
            <TimeSlotContextMenus>
                <telerik:RadSchedulerContextMenu ID="SchedulerTimeSlotContextMenu" runat="server">
                    <Items>
                        <telerik:RadMenuItem Text="Nieuwe Afspraak" Value="CommandAddAppointment" />
                        <telerik:RadMenuItem Text="Naar Vandaag" Value="CommandGoToToday" />
                        <telerik:RadMenuItem Text="Naar Herhaalafspraak" Value="CommandAddRecurringAppointment" />
                        <telerik:RadMenuItem Text="Geef 24 uur..." Value="CommandShow24Hours" />
                    </Items>
                </telerik:RadSchedulerContextMenu>
            </TimeSlotContextMenus>
            <AppointmentContextMenus>
                <telerik:RadSchedulerContextMenu runat="server" ID="ContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="Afspraak wijzigen" Value="CommandEdit" />
                        <telerik:RadMenuItem Text="Afspraak verwijderen" Value="CommandDelete" />
                    </Items>
                </telerik:RadSchedulerContextMenu>
            </AppointmentContextMenus>
        </telerik:RadScheduler>
        <asp:LinqDataSource ID="ldeAgenda" runat="server" ContextTypeName="AGenda.AgendaDataContext"
            TableName="Agendas" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
        </asp:LinqDataSource>

    Reply

  • Peter Peter admin's avatar

    Posted on Jan 23, 2012 (permalink)

    Hi Antony,

    When you open the advanced form, the focus should be in the Subject textbox field. Can you specify which online demo has different behavior?

    Greetings,
    Peter
    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

    Reply

  • Antony avatar

    Posted on Jan 25, 2012 (permalink)

    I tested this demo Scheduler / Web Service.    

    Reply

  • Peter Peter admin's avatar

    Posted on Jan 27, 2012 (permalink)

    Hi Antony,

    Could you please try the following workaround and let me know if it helps?

    Telerik.Web.UI.RadScheduler.prototype._onKeyboardEvent = function (e) {
        var $T = Telerik.Web.UI;
        var $ = $telerik.$;
      
     
      
        var selectionState = this._rowSelectionState;
        // Escape
        if (e.keyCode == 27 && !$(".rsAdvancedInsertWrapper").is(":visible")) {
            if (this._dragging) {
                this._abortDrag(e, true);
            }
      
            if (this._resizingState.resizing) {
                this._restoreResizingAppointmentSize();
                this._cleanupResize();
            }
      
            if (!selectionState.isRowSelection)
                this._clearSlotSelection();
        }
      
        //Enter key
        if (e.keyCode == 13 && !$(".rsAdvancedInsertWrapper").is(":visible")) {
            if (selectionState.isRowSelection) {
                this._abortRowSelection();
            }
            if (selectionState.selectedSlots.length > 0 && !this.get_readOnly() && this.get_allowInsert()) {
                if (!this._lastSelectedApt) {
                    var startSlot = selectionState.selectedSlots[0];
                    var endSlot;
                    var aptDuration = this.get_durationOfSelectedArea();
                    if (!aptDuration) {
                        this._clearSlotSelection();
                        return;
                    }
                    else {
                        endSlot = selectionState.selectedSlots[selectionState.selectedSlots.length - 1];
                    }
      
                    var eventArgs = new $T.SchedulerAppointmentInsertingEventArgs(
                                    startSlot.get_startTime(), startSlot.get_isAllDay(), startSlot);
                    this._raise_appointmentInserting(eventArgs);
      
                    if (!eventArgs.get_cancel()) {
                        e.preventDefault();
                        this.showInsertFormAt(startSlot, endSlot);
                    }
      
                    return false;
                }
            }
        }
    }

     

    All the best,
    Peter
    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

    Reply

  • Antony avatar

    Posted on Feb 6, 2012 (permalink)

    I'm sorry to reply now, because I was on vacation.

    I tried the code, the escape key does stop, but when I press the return key, it closes the form. 

    Reply

  • Peter Peter admin's avatar

    Posted on Feb 8, 2012 (permalink)

    Hello Antony,

    Here is a modification of the code. Please, try it and let me know if it fixes the problem at your side:
    Telerik.Web.UI.RadScheduler.prototype._onKeyboardEvent = function (e) {
        //Enter key
        if (e.keyCode == 13) {
            if (selectionState.isRowSelection) {
                this._abortRowSelection();
            }
            if (selectionState.selectedSlots.length > 0 && !this.get_readOnly() && this.get_allowInsert()) {
                if (!this._lastSelectedApt) {
                    var startSlot = selectionState.selectedSlots[0];
                    var endSlot;
                    var aptDuration = this.get_durationOfSelectedArea();
                    if (!aptDuration) {
                        this._clearSlotSelection();
                        return;
                    }
                    else {
                        endSlot = selectionState.selectedSlots[selectionState.selectedSlots.length - 1];
                    }
      
                    var eventArgs = new Telerik.Web.UI.SchedulerAppointmentInsertingEventArgs(
                                            startSlot.get_startTime(), startSlot.get_isAllDay(), startSlot);
      
                    this._raiseAppointmentInserting(eventArgs);
                    return false;
                }
            }
        }
    }


    Greetings,
    Peter
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • Antony avatar

    Posted on Feb 8, 2012 (permalink)

    I changed it to this and now it works:

    Telerik.Web.UI.RadScheduler.prototype._onKeyboardEvent = function (e) {
                
                   //Enter key
     
                   if (e.keyCode == 13) {
     
                       return false;
     
                   }
                   return true;
               }

    Reply

  • Marc-Antoine avatar

    Posted on May 16, 2012 (permalink)

    Hello,

    I've the same problem, i use an Advanced Template to insert appointment. But when i press Enter key, i loose Focus but i'm not logged out. In fact, can't press Enter key to insert new line in the description comboBox.
    I use WebService binding, and exclusively advanced insert form.
    I would like to try the javascript code you posted but i don't know where i can place it.

    Thank you for your Help,

    Marc-Antoine.

    Reply

  • Plamen Zdravkov Plamen Zdravkov admin's avatar

    Posted on May 16, 2012 (permalink)

    Hi Marc-Antoine,

     
    I am glad to inform you that this issue was recently fixed and you can just use the Latest Internal Build of RadConrols.

    If you still want to use the javascript code you can add it to the page where is situated RadScheduler in script tag shown in the code:

    <script type="text/javascript">
       ...
       </script>

    Hope this will be helpful.Regards,
    Plamen Zdravkov
    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Scheduler > Pressing enter key in advanced form lost focus
Related resources for "Pressing enter key in advanced form lost focus"

ASP.NET Scheduler Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial ]