开发者

Behavior of enter key in textbox

开发者 https://www.devze.com 2022-12-24 14:24 出处:网络
I am making a very simple feedback form for an MS-Access application I\'m working on. It consists of a textbox (for comments), a Submit button, and a Cancel button.

I am making a very simple feedback form for an MS-Access application I'm working on. It consists of a textbox (for comments), a Submit button, and a Cancel button.

In your opinion, wh开发者_StackOverflow社区en the focus is on the textbox, is it more intuitive for the Enter/Return key to click the Submit button or move the cursor to the next line within the textbox?

Edit: The textbox is obviously multi-line.


Standard Access UI is that in a data entry form, the ENTER key is equivalent to the TAB, i.e., moves to the next control in the tab order.

The exception to this default behavior is textboxes that are bound to memo fields. In that case, the default is to have the ENTER key insert a CrLf in the bound memo. Textboxes have a property for this.

In a feedback form, it seems to me that the ENTER key should create a new line when the focus is on the textbox where the user is to type the feedback. ENTER should submit the form only when the focus is on the SUBMIT button.

All that said, your terminology sounds very web-like (nobody uses "submit button" in database forms programming, and certainly not in Access). I like certain aspects of HTML forms and the ENTER key, but have learned from watching others that 99% of the users out there don't know that in an HTML form the ENTER key submits the form (when the focus is not on a multi-line input box).

It's possible to set a command button on a form as the default button, such that hitting the ENTER key will click the command button, but for anything other than a dialog form, that's usually inadvisable in my experience. Users don't expect the ENTER key to execute a command button and making it do so is just likely to confuse them, even if it does make the Access form behave something like HTML forms.


I'd suggest that this depends on your layout: in an obviously multi-line textbox, the average user might expect Enter to move to a new line. In a single-line textbox, we generally don't expect that behaviour.


Depending on the structure of the form. If the form has several textboxes, I expect it not to send the data when I hit Enter, except maybe on the last text box. Hitting Enter should do nothing, or move the focus to the next text box if you're feeling creative (most users will find this behaviour strange - it is not common in WinForms to move between input fields on pressing Enter).

If the form really consists of one text box and a submit button, then maybe sending the data when i hit Enter is ok, but I'd still be careful - users will not expect this behaviour, except in obvious places (like Google's search text box), and it will annoy the users if they accidently hit Enter and have their incomplete form being sent.


For a multi-line textbox, yes. It's more intuitive for the Enter key to go to the next line. However, in almost every other case (at least for my users), the Enter key should "hit" the "Submit" button.

Caveat: Most of my users use forms with textboxes to do a Search function against the database, which then populates textboxes in another form that disallow editing. My spiffy way to avoid them creating "new" customers that aren't real.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号