Captcha or other way to protect My Contact Form :)
Hey Umbracian,
do you know a way to protect a Contact form, I am using RVContactForm, which is using Ajax to post the form. I want to protect the form through Captcha ( as far as i know ) or if you prefer other solution.
is there a solution to make it work out with AJAX and without a lot of code !!?
function CAPTCHAFail(msg) { var str = 'say something'; } function CAPTCHASuccess(msg) { if(msg.d==true) { var myMailerRequest= 'prepare some thing inside the message !!' // JSONify the js object - desirialize js object to MailerRequest object. the first param must be equal to the name of the input parameter in the web service method "SendContactForm" var data = JSON.stringify({ req: myMailerRequest }); $.ajax({ type: "POST", url: "/umbraco/webservices/RVContactFormMailer.asmx/SendContactForm", data: data, contentType: "application/json; charset=utf-8", dataType: "json", success: AjaxSucceeded, error: AjaxFailed }); } else { alert('Please enter a Correct Captcha'); return; } } function AjaxSucceeded(result) { //some jquery transformation and animation for appending result !! } function AjaxFailed(result) { // tell the user about the failure !! }
Captcha or other way to protect My Contact Form :)
Hey Umbracian,
do you know a way to protect a Contact form, I am using RVContactForm, which is using Ajax to post the form.
I want to protect the form through Captcha ( as far as i know ) or if you prefer other solution.
is there a solution to make it work out with AJAX and without a lot of code !!?
Thanks in advance :)
Cheers,
Firas.
hi,
there is a lot of possibilities to do that:
you have technics that unrelated to umbraco but can be used, like aksimet or stuff like this.
and of course you can examine one of the umbraco packages that using spam filters and take to right code from it.
please update me if you will develop something nice. maybe i will consider to insert it to future update of the RVContactForm package.
Thanks!
Eran
Hi Eran,
here is the solution for this:
I used google Recaptcha
I will put the steps below, just to help other to integrate it, but it would be better to integrate it with your solution :).
in the dll source code (the webservice) i have added a method:
in the body a Div for My Captcha
<div id="DivID">
<div>
now edit the RVContactForm.js
replace the code for sending with this one (ajaxSubmit) with this below:
var captchaInfo =
{
challengeValue: Recaptcha.get_challenge(),
responseValue: Recaptcha.get_response()
};
$.ajax
({
type: 'POST',
url: '/umbraco/webservices/RVContactFormMailer.asmx/ValidateCaptcha',
data: JSON.stringify(captchaInfo),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: CAPTCHASuccess,
error: CAPTCHAFail
});
add 2 new functions:
function CAPTCHAFail(msg) {
var str = 'say something';
}
function CAPTCHASuccess(msg) {
if(msg.d==true)
{ var myMailerRequest= 'prepare some thing inside the message !!' // JSONify the js object - desirialize js object to MailerRequest object. the first param must be equal to the name of the input parameter in the web service method "SendContactForm"
var data = JSON.stringify({ req: myMailerRequest });
$.ajax({
type: "POST",
url: "/umbraco/webservices/RVContactFormMailer.asmx/SendContactForm",
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
}
else {
alert('Please enter a Correct Captcha');
return;
}
}
function AjaxSucceeded(result) {
//some jquery transformation and animation for appending result !!
}
function AjaxFailed(result) {
// tell the user about the failure !!
}
hope it help some Umbracian around :)
Cheers,
Firas.
is working on a reply...