Pressing enter key in advanced form lost focus

9 posts, 0 answers
  1. Antony
    Antony avatar
    4 posts
    Member since:
    Jan 2012

    Posted 20 Jan 2012 Link to this post

    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>

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Jan 2012 Link to this post

    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
  3. Antony
    Antony avatar
    4 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2012 Link to this post

    I tested this demo Scheduler / Web Service.    
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 Jan 2012 Link to this post

    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
  5. Antony
    Antony avatar
    4 posts
    Member since:
    Jan 2012

    Posted 06 Feb 2012 Link to this post

    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. 
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 08 Feb 2012 Link to this post

    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 >>
  7. Antony
    Antony avatar
    4 posts
    Member since:
    Jan 2012

    Posted 08 Feb 2012 Link to this post

    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;
               }
  8. Marc-Antoine
    Marc-Antoine avatar
    6 posts
    Member since:
    Apr 2012

    Posted 16 May 2012 Link to this post

    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.
  9. Plamen
    Admin
    Plamen avatar
    2959 posts

    Posted 16 May 2012 Link to this post

    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.
Back to Top