保存按钮以验证并仍然保存数据 [英] Save button to validate and still save data

查看:80
本文介绍了保存按钮以验证并仍然保存数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页表单,上面有验证器和文本框。我希望用户保存他们的数据,以便他们可以回来完成他们的工作。当用户点击保存按钮时,验证会触发我想要的但我仍然希望数据保存在数据库中。有没有办法做到这一点并保持验证器触发?

I have a web form that has validators on it along with textboxes. I want the user to save their data so that they can come back and finish their work. When the user clicks on the save button the validations fires which is what I want but I still want the data to save in the database. Is there a way to do this and keep the validators firing?

推荐答案

你想要实现的就像离线版本的表格。如果是这样,您可以自动将用户的数据保存在localStorage(HTML5)中。 https://developer.mozilla.org/en-US/docs/Web/指南/ API / DOM /存储 [ ^ ]



您可以保存用户在localStorage中输入的数据,点击保存按钮后,您可以验证数据。请注意,有许多方法可以验证数据。使用客户端代码以及使用服务器端代码。



这取决于你想如何对数据进行验证。
What you're trying to achieve is like offline versions of forms. If so, you can automatically save the data of the user in the localStorage (HTML5). https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage[^]

You can save the data the user would input in the localStorage, and upon the Save button clicks, you can validate the data. Note that there are many methods to validate the data. Using client-side code as well as using server-side code.

It depends on how you want to implement the validation to your data.


这篇关于保存按钮以验证并仍然保存数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆