用于表示时间量的 GUI 控件
我有一个输入询问提交者事件花费了多长时间。现在它是一个普通的文本框,如果提交了除整数之外的任何内容,则应该会出错。我告诉提交者输入整分钟的长度。
然而,几分钟内思考并不是大脑最好的能力……遵循指示也不是,所以我经常收到“支持请求”,指出“我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为什么不让你的控件更智能一点并允许输入:
1h
、40m
、1.5h
、1,5h
、2d5h
等。或者,您可以在服务器端“AJAXly”解析此值并提供并排提示,该提示将说明您的程序的准确程度将解释该值。此外,您可以使用一些合理的默认值,例如
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.Additionally, you can use some reasonable defaults, like
1.5
(or1,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.一种简单的方法是使用一个接受浮点输入的框和另一个用于选择单位的控件。例如,
您的服务器代码可以枚举用于生成控件和解释提交的单元。
在数字条目旁边的控件中明确提及单位应该有助于用户不阅读说明 - 如果它与他们的数据一起存在,他们可能更有可能做正确的事情重新输入,而不是阅读上面段落中细则中的每一个小细节。
(话虽如此,我也很喜欢安东·戈戈列夫的回答。如果你能做到,那就这么做。)
An easy way to do this would be to have a box accepting floating point input and another control to select units. For example
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.)
您可以显示多个接受整数的输入框,每个输入框对应一个特定的时间单位:
用户可以填写任何一个框或两个框。
You can display several input boxes accepting integers, each for a specific unit of time:
The user can fill any single box or both.