Validating input fields. Usability

痞子三分冷 提交于 2019-12-11 22:25:24

问题


I am doing site, which will help people to collect their water meters readings. At the moment I am doing input form for adding current month readings.

Browser is checking data when user input it, not on/after form sending (via jquery). For example, user inputted 123 and pressed d after. After he pressed d error will appear near input field etc... So field is validating on keyup action

I am thinking about adding test, that will be passed if user inputted value, that is not lesser then previous month (or not previous month, just last inputted) value.

So imagine: Last month meter value was 250. Current 255. Input field is blank. User staring print. He pressing 2 (inputted value is 2 now). Remember that value is being tested on key up? jQuery will start test and will return error because 2 (current value in field) < 250 (last month meter value). After that he pressing 5 (inputted value is 25 now). 25 < 250, so jquery will still show error, that value, user inputting is invalid. After that he printing 5 again (now value inputted is 255). 255 not < then 250, so error message/block will disappear.

So the question is such: is it correct to show error on keyup for this test (checking if inputted value is less then last month value)? I think it is not rly correct, because some users are very newb to pc's and this message can scare them or idk :)))
Is it okay or should I find a way to test this only on onblur action (remove focus from field)? But will it be too late to show error message (I mean usability ofc)? I am checking inputs when ppl input their data because of better usability (so ppl know about his mistake on input stage, not after sending form).

Maybe there are another suggestion?


回答1:


Add 2 events, one onkeyup and one onblur? The onkeyup can check for incorrect characters and the onblur can compare the input value to last month




回答2:


Add a timeout to the keyup, this is a possible duplicate of this same issue:

How to trigger an onkeyup event that's delayed until a user pauses their typing?



来源:https://stackoverflow.com/questions/22492862/validating-input-fields-usability

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!