使用验证码验证表格 [英] validating Form with captcha

查看:88
本文介绍了使用验证码验证表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含几个字段,验证码和提交按钮的表单。



现在我正在使用



I have create a form with a few fields, captcha and a submit button.

for now I am using

<pre lang="HTML"> <input class="btn btn-lg" name="Submit" onclick="return validate();" type="submit" value="Submit">





如果验证码相同或不相同,则验证函数返回。通过提交消息点击提交。



现在的问题是如何提交表格? (我已经在validate()函数中使用onclick验证验证码)



validate function returns if the captcha is same or not . by throwing a message onclick of submit.

The problem now is how do I submit the form ? (I have already used onclick to validate the captcha)

推荐答案

,返回true将导致提交表单。

in the validate() function, returning true will result in submission of the form.
// pseudo code
function validate(){
   // code to validate captcha
   if (//outcome of captcha is true//) {
       return true; // form will be submitted
   } else {
       alert(message);
       return false; // form will not be submitted
   }
}


这篇关于使用验证码验证表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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