用于表示时间量的 GUI 控件

发布于 2024-09-06 02:07:02 字数 196 浏览 9 评论 0原文

我有一个输入询问提交者事件花费了多长时间。现在它是一个普通的文本框,如果提交了除整数之外的任何内容,则应该会出错。我告诉提交者输入整分钟的长度。

然而,几分钟内思考并不是大脑最好的能力……遵循指示也不是,所以我经常收到“支持请求”,指出“我的 1.5 小时的输入没有起作用”。

有没有什么好的方法可以要求用户提交一段时间,并接受除分钟以外的回报?

I have an input asking the submitter how long an event took. Right now it's a normal textbox that should error out if anything but an integer is submitted. I tell the submitter to input the length in whole minutes.

However, thinking in minutes isn't the brains best ability... Neither is following instructions, so I often get "support-requests" that state that "my input of 1,5 hours didn't work".

Is there any good way of requesting the user to submit a length of time, and accepting other than minutes in return?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

临走之时 2024-09-13 02:07:02

为什么不让你的控件更智能一点并允许输入:1h40m1.5h1,5h2d5h 等。或者,您可以在服务器端“AJAXly”解析此值并提供并排提示,该提示将说明您的程序的准确程度将解释该值。

                -----------------
Enter Timespan: | 2d1.5h        |   (2 days and 1.5 hours, 25.5 hours total)
                -----------------

此外,您可以使用一些合理的默认值,例如 1.5 (或 1,5)很可能是 1.5 小时,而不是 1.5 分钟,并且应该这样解释。 0,5 也不是 30 秒,而是 30 分钟,等等。

Why won't you make your control a bit more intelligent and allow this to be entered: 1h, 40m, 1.5h, 1,5h, 2d5h, etc. Optionally, you can "AJAXly" parse this value on the server side and provide a side-by-side hint, which will state how exactly your program will interpret the value.

                -----------------
Enter Timespan: | 2d1.5h        |   (2 days and 1.5 hours, 25.5 hours total)
                -----------------

Additionally, you can use some reasonable defaults, like 1.5 (or 1,5) is most likely 1.5 hours, not 1.5 minutes, and should be interpreted as such. 0,5 is not 30 seconds as well, but rather 30 minutes, etc.

静若繁花 2024-09-13 02:07:02

一种简单的方法是使用一个接受浮点输入的框和另一个用于选择单位的控件。例如,

Time: [ 4.1     ] [ hours ] <- select units from this drop down box
Time: [ 0.5     ] [ days  ]
Time: [ 1e-3    ] [ years ]

您的服务器代码可以枚举用于生成控件和解释提交的单元。

在数字条目旁边的控件中明确提及单位应该有助于用户不阅读说明 - 如果它与他们的数据一起存在,他们可能更有可能做正确的事情重新输入,而不是阅读上面段落中细则中的每一个小细节。

(话虽如此,我也很喜欢安东·戈戈列夫的回答。如果你能做到,那就这么做。)

An easy way to do this would be to have a box accepting floating point input and another control to select units. For example

Time: [ 4.1     ] [ hours ] <- select units from this drop down box
Time: [ 0.5     ] [ days  ]
Time: [ 1e-3    ] [ years ]

Your server code can enumerate the units for generating the control and interpreting the submission.

The explicit mention of the units in the control right next to the number entry should help with users not reading instructions — they're probably far more likely to do the right thing if it's there with the data they're entering, than to read every little detail in the fine print a paragraph above it.

(Having said that, I really like Anton Gogolev's answer too. If you can pull it off, do that.)

如何视而不见 2024-09-13 02:07:02

您可以显示多个接受整数的输入框,每个输入框对应一个特定的时间单位:

Time:  [  1 ] day  [  4 ] hours    [ 26 ] minutes   [ 42 ] seconds

用户可以填写任何一个框或两个框。

You can display several input boxes accepting integers, each for a specific unit of time:

Time:  [  1 ] day  [  4 ] hours    [ 26 ] minutes   [ 42 ] seconds

The user can fill any single box or both.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文