简体   繁体   English

如何禁用提交按钮,直到用户刷新页面?

[英]How to disable a submit button until user refreshes the page?

I have a multi-step form and my form is divided in three pieces, so all and good. 我有一个多步骤表单,我的表单分为三部分,所以一切都很好。

I want that if the user clicks on the final submit button after validation in JavaScript and PHP the user get redirected to my desired page but the submit button must be disabled if he clicks on the back button the button must be unclickable until he refreshes the complete form. 我希望如果用户在JavaScript和PHP中进行验证后单击最终提交按钮,则该用户将重定向到我所需的页面,但是如果他单击后退按钮,则必须禁用该提交按钮,直到刷新整个按钮后,该按钮必须不可单击形成。

Form code: 表单代码:

<form id="newlogo" class="sky-form" name="newlogo" method="post" action="action.php"> 
/* reandom inputs */

Final submit button: 最终提交按钮:

<button type="submit" name="form_btn" id="sub" class="button" onclick="return logotype() ,logotype()">Submit</button>

I just need to disable this button if it past the validation codes and enable it only by refresh. 我只需要禁用此按钮(如果它超过了验证代码),而只能通过刷新启用它。

您可以使用cookie并保持按钮的状态启用/禁用

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

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