输入登录表单的密钥
我的网站上有一个搜索表单和一个登录表单。当登录表单具有焦点时按下 Enter 按钮时,将运行搜索而不是登录。有办法解决这个问题吗?
我已经尝试在登录表单周围使用面板并使用默认按钮,但是当我这样做时,登录视图会出错。
I have a search form and a login form on my website. When the enter button is pressed when the login form has focus, the search runs instead of the login. Is there a way to fix this?
I've already tried using a panel around the login form and use defaultbutton, but the loginview errors when I do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试在登录表单上设置按键事件。在我的脑海中,
假设您为所涉及的元素提供了适当的 ID,类似的东西应该可以工作。
You could try setting up a keypress event on your login form. Off the top of my head, something like
should work, assuming you give appropriate IDs to the elements involved.
如果您谈论的是 HTML,则 这建议使用 Tab 键顺序(在此处了解更多信息)相关或表单创建的顺序,行为取决于用户代理。
If you're talking about HTML, then this suggests tab order (learn more about that here) is relevant or the order in which the forms were created, the behavior depending on the user agent.
您可以尝试在运行时添加像这样的属性
和一些 JS:
UPDATE
自动转换为 VB.NET 由 telerik 提供
could you try adding attributes at run time like this
and some JS:
UPDATE
Auto-converted to VB.NET courtesy of telerik