简体   繁体   English

原子*应该如何*我制作一个Ajax表单?

[英]How atomic *should* I make an Ajax form?

I have some web forms that I'm bringing over with AJAX, and as I was dealing with the database on the back end, I thought that it might be easier to just handle each input on the form atomically with AJAX, saving the form in 'real time' as the user edits it. 我有一些Web表单,我正在使用AJAX,当我在后端处理数据库时,我认为用AJAX原子地处理表单上的每个输入可能更容易,保存表单用户编辑时的“实时”。 The forms are ~20 fields of administrative settings. 这些表格是大约20个管理设置字段。

Would this create massive overhead with the app, cause it to be error-prone, or is this a feasible idea? 这是否会给应用程序带来巨大的开销,导致它容易出错,或者这是一个可行的想法? Of course, contingent operations (like a checkbox that then requires a text entry) would be held until the textbox gained and lost focus. 当然,在文本框获得并失去焦点之前,将持续进行偶然操作(如需要文本输入的复选框)。

Comments? 评论?

Obviously this would lead to a lot more HTTP requests being made to save the user's data, along with a lot more updates in your database. 显然,这将导致更多的HTTP请求被保存用户的数据,以及数据库中的更多更新。 So this approach is definitely more expensive than a single submit. 所以这种方法肯定比单次提交更昂贵。 Whether or not it's overly expensive depends on your server load. 它是否过于昂贵取决于您的服务器负载。

To me, the big difficulty is that users have been trained to expect that forms only save data when they hit "submit". 对我来说,最大的困难是用户已经接受过培训,希望表单只在他们点击“提交”时保存数据。 There'd be a certain amount of work you'd have to do to make it obvious to them that you're auto-saving their input. 你需要做一些工作才能让他们明白你是在自动保存他们的输入。 Some users might be concerned by the lack of a "save" button, and others might complain that they started editing their data, but then changed their mind, and now their partially-complete data has inexplicably overwritten their old data. 一些用户可能会担心缺少“保存”按钮,而其他人可能会抱怨他们开始编辑他们的数据,但后来改变了主意,现在他们的部分完整数据已经莫名其妙地覆盖了他们的旧数据。

I'm inclined to view it as more trouble than it's worth. 我倾向于认为它比它的价值更麻烦。 But others might weigh these things differently. 但其他人可能会对这些事情进

Seems overly complicated. 似乎过于复杂。 A well placed Save button(s) would work fine for all users, and be more usable. 一个位置很好的保存按钮可以适用于所有用户,并且更加实用。 Not to mention it will save you(coding) and your server(bandwidth) a lot of work. 更不用说它会为你(编码)和你的服务器(带宽)节省大量的工作。

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

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