about summary refs log tree commit diff
path: root/wqflask/wqflask/static/new/packages/ValidationPlugin/demo/captcha/captcha.js
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/wqflask/static/new/packages/ValidationPlugin/demo/captcha/captcha.js')
-rw-r--r--wqflask/wqflask/static/new/packages/ValidationPlugin/demo/captcha/captcha.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/wqflask/wqflask/static/new/packages/ValidationPlugin/demo/captcha/captcha.js b/wqflask/wqflask/static/new/packages/ValidationPlugin/demo/captcha/captcha.js
new file mode 100644
index 00000000..f3429c2a
--- /dev/null
+++ b/wqflask/wqflask/static/new/packages/ValidationPlugin/demo/captcha/captcha.js
@@ -0,0 +1,27 @@
+$(function(){
+	$("body").on("click", "#refreshimg", function(){
+		$.post("newsession.php");
+		$("#captchaimage").load("image_req.php");
+		return false;
+	});
+
+	$("#captchaform").validate({
+		rules: {
+			captcha: {
+				required: true,
+				remote: "process.php"
+			}
+		},
+		messages: {
+			captcha: "Correct captcha is required. Click the captcha to generate a new one"
+		},
+		submitHandler: function() {
+			alert("Correct captcha!");
+		},
+		success: function(label) {
+			label.addClass("valid").text("Valid captcha!")
+		},
+		onkeyup: false
+	});
+
+});