简体   繁体   English

停止输入时保存输入/文本框而不提交按钮

[英]Saving input/textbox without submit button on stopped typing

Just seeing if there's any best practice stuff on saving text inputs without a submit button.只是看看是否有关于在没有提交按钮的情况下保存文本输入的最佳实践。 I've got this working fine with a delay when input is stopped using Jquery (on MVC site Ajax to Controller) but this still keeps posting data when a user waits to continue typing etc.当使用 Jquery(在 MVC 站点 Ajax 到控制器上)停止输入时,我已经可以正常工作了,但是当用户等待继续输入等时,它仍然会继续发布数据。

I'd ideally like a way of determining that a user has finished updating text within a textbox/text field without the need for a physical save button.理想情况下,我想要一种确定用户已完成更新文本框/文本字段中的文本而无需物理保存按钮的方法。

Is there a client side library/function I can use or even cache with writes on the server side & then write to db after a delay?是否有客户端库/函数我可以使用甚至缓存在服务器端写入然后在延迟后写入数据库?

It depends on how you are determining the user has finished updating the text.这取决于您如何确定用户已完成文本更新。 Since you don't want to post data after delay then, I guess, the only way here is to check when the user changes focus from the text input field.由于您不想在延迟之后发布数据,我想,这里的唯一方法是检查用户何时从文本输入字段更改焦点。 In that case you can use onfocusout event.在这种情况下,您可以使用onfocusout事件。

<input type="text" onfocusout="postData(value)" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM