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

Pressing enter key in advanced form lost focus

8 Answers 73 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Antony
Top achievements
Rank 1
Antony asked on 20 Jan 2012, 04:03 PM

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>

8 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Jan 2012, 05:16 PM
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
0
Antony
Top achievements
Rank 1
answered on 25 Jan 2012, 01:19 PM
I tested this demo Scheduler / Web Service.    
0
Peter
Telerik team
answered on 27 Jan 2012, 10:49 AM
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
0
Antony
Top achievements
Rank 1
answered on 06 Feb 2012, 09:28 AM
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. 
0
Peter
Telerik team
answered on 08 Feb 2012, 02:32 PM
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 >>
0
Antony
Top achievements
Rank 1
answered on 08 Feb 2012, 04:32 PM
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;
           }
0
Marc-Antoine
Top achievements
Rank 1
answered on 16 May 2012, 07:09 AM
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.
0
Plamen
Telerik team
answered on 16 May 2012, 09:29 AM
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.
Tags
Scheduler
Asked by
Antony
Top achievements
Rank 1
Answers by
Peter
Telerik team
Antony
Top achievements
Rank 1
Marc-Antoine
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or