简体   繁体   中英

Calendar widget (JavaScript) and usability issue

I want to use Calendar widget to help users select date.

I wish use any standalone calendar or as a jquery plugin. In my project i'm using jquery, and i don't want to use any other frameworks.

I saw a lot of calendars, but they all has the same problem. I will describe it now, see below:

There are possible two way to show up calendar: 1. to click on some button, icon etc to show it up. 2. to click on text field (where we will see result of date selection) to show it up

I choosed 2nd way. In my case i will have only ONE text field without any addition icons, buttons etc. When this text field get focus the calendar will be show up. When user selected any date, calendar will be hidden, and text field will show selected date.

And here I have main problem...

After appearing the calendar the text field is loosing focus. And after selection date, focus did not got back to this field, and key (on keyboard) beginning run from start.

From usability point it would be good if when user finish selection date from calendar, and selected date shows up in text field, he can keep using key to go to next text field.

Any ideas how to solve it ?

PS I have only one idea, but i don't like it, because it looks me little bit ugly

When calendar is shows up, i could destroy event handler (focus event) on text field. When user selected date and calendar is disappearing, i can set focus on this text field and attach event listener (focus) for this text field again.

Thanks.

由于JavaScript是一种单线程语言,你只需将一个变量( disableEvents或其他)设置为true,并在调用.focus()时将其设置为false - 这不会造成任何麻烦,也不需要太多工作。

jQuery-UI的日期选择器不会将焦点发送到弹出日历小部件,而是希望用户使用替代控件来更改日期,此外,这将允许用户在需要时手动键入日期。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM