停止回发,手动执行

发布于 2024-10-12 07:24:53 字数 206 浏览 1 评论 0原文

我的主页是带有模型的注册表单。当用户单击提交按钮时,模型将进行验证并发布。然而,我需要在这之间采取一个步骤,迫使用户同意一些条款和细则。

最初,我想将模型带入第二个确认页面,然后转到保存信息的第三个 ActionResult。

其次,我想隐藏主 DIV,然后显示协议“存在”的第二个 DIV,然后发回。但我不确定在显示第二个 DIV 之前如何验证模型,然后发布表单。

My main page is a registration form with a Model. When the user clicks the submit button, the model validates and posts. However, I am in need of a step in between that forces the user to agree to some terms and fine print.

Originally, I was thinking that I would carry the model into a second confirmation page and then move onto a third ActionResult that saved the information.

Second, I thought of just hiding the main DIV and then showing a second DIV that the agreements "live" in and then post back. But I'm not sure how I would validate the model before showing the second DIV and THEN post the form.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

九厘米的零° 2024-10-19 07:24:53

为什么不将细则和条款(以及相应的复选框)作为注册表的一部分?几乎所有地方都是这样做的,不是吗?

Why not just include the fine print and terms (and corresponding checkbox) as part of the registration form? That's how it's done pretty much everywhere, isn't it?

野稚 2024-10-19 07:24:53
<form id="myForm">
...
<input type="button" id="formSubmit">
</form>
<div id="agreement"></div>

<script>
$(document).ready(function(){
$("#agreement").hide();
}):

$("#formSubmit").click(function(){
$("#agreement").show();
//ur logic to check if the user agree or disagree
$.ajax({
type:POST,
data:"formdata"
url:"/your/url"
success:function(){

}


});
});
</script>
<form id="myForm">
...
<input type="button" id="formSubmit">
</form>
<div id="agreement"></div>

<script>
$(document).ready(function(){
$("#agreement").hide();
}):

$("#formSubmit").click(function(){
$("#agreement").show();
//ur logic to check if the user agree or disagree
$.ajax({
type:POST,
data:"formdata"
url:"/your/url"
success:function(){

}


});
});
</script>
執念 2024-10-19 07:24:53

如果用户可能拒绝您的条款和细则,为什么还要额外调用来验证模型呢?我认为您应该按照@Daniel 的建议进行操作,或者如果您必须这样做,则发布您的模型,返回验证,显示您的细则,然后再次将表单发布到不同的操作以保存。

Why make an extra call to validate the model if the user might reject your terms and fine print. I think you should either do what @Daniel recommends or if you must do it this way, post your model, get the validation back, show your fine print and then post the form again to a different action to save.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文