How to add Captcha in Custom Sitefinity Form Builder?
Hello Team:
I have Custom form builder, i want to include captcha control in the form builder. i found one link from this url "www.sitefinity.com/.../captcha_for_sitefinity_forms" regarding how to add captcha.
i want download that captcha project, but i am not getting where is the link to download captcha form control.
Please give the url to download captcha project, so that i will include that project to my custom form builder.
Thanks in advance!!!!!!
Saroj Rout
Hello Saroj,
Thanks for using Sitefinity.
The captcha form project is in the SDK under samples. You can download the SDK from here.
I hope this helps.
Hi
i have downloaded the SDK and installed but didn't get any Captcha project in the sample folder. Please send me the exact link to download or give me a zip file of the captcha project if you have.
Thanks in advanced
Dear Patrick
Still think Chaptcha support for forms build should come out of the box.
Saroj vote here: http://www.telerik.com/support/pits.aspx#/details/Issue=10655 already 43 votes. So Telerik this is a requeste feature!
Markus
Does anyone know where the captcha project went? It's no longer in the SDK.
Hello Mark,
The project is not removed from the Sitefinity SDK. Check the Akismet(http://akismet.com/) integration sample available there.
Regards,
Stefani Tacheva
Telerik
I'm embedding this into my randomsitecontrols on next release...but...
1) Add captcha to your forms toolbox, just edit your toolboxconfig and add this node (on the same level as the others)
<
toolbox
name
=
"FormControls"
>
<
sections
>
<
add
name
=
"Common"
>
<
tools
>
<
add
enabled
=
"True"
type
=
"Telerik.Web.UI.RadCaptcha, Telerik.Web.UI"
title
=
"RadCaptcha"
description
=
"RadCaptcha"
visibilityMode
=
"None"
name
=
"RadCaptcha"
/>
</
tools
>
</
add
>
</
sections
>
</
toolbox
>
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Linq;
using
System.Net;
using
System.Net.Mail;
using
System.Text;
using
System.Text.RegularExpressions;
using
Telerik.Microsoft.Practices.EnterpriseLibrary.Logging;
using
Telerik.Sitefinity.Configuration;
using
Telerik.Sitefinity.Modules.Forms;
using
Telerik.Sitefinity.Modules.Forms.Web.UI;
using
Telerik.Sitefinity.Modules.Forms.Web.UI.Fields;
using
Telerik.Sitefinity.Services;
using
Telerik.Sitefinity.Web.UI;
using
Telerik.Sitefinity.Web.UI.Fields;
using
Telerik.Web.UI;
namespace
RandomSiteControls.Forms
/// <summary>
/// Add the captcha control to your toolbox like this
/// <toolbox name="FormControls">
/// <sections>
/// <add name="Common">
/// <tools>
/// <add enabled="True" type="Telerik.Web.UI.RadCaptcha, Telerik.Web.UI" title="RadCaptcha" description="RadCaptcha" visibilityMode="None" name="RadCaptcha" />
/// </tools>
/// </add>
/// </sections>
/// </toolbox>
/// </summary>
public
class
FormCaptcha : FormsControl
protected
override
void
InitializeControls(GenericContainer container)
if
(!SystemManager.IsDesignMode)
//Hide the form if JS is disabled, it'll let them bypass the required fields.
base
.InitializeControls(container);
this
.BeforeFormSave +=
new
EventHandler<CancelEventArgs>(FormsControlCustom_BeforeFormSave);
#region EVENTS
protected
void
FormsControlCustom_BeforeFormSave(
object
sender, CancelEventArgs e)
if
(
this
.MyCaptcha !=
null
)
if
(!
this
.MyCaptcha.IsValid)
e.Cancel =
true
;
this
.MyCaptcha.ErrorMessage =
this
.CaptchaErrorMessage;
#endregion
#region METHODS
#endregion
#region Properties
private
RadCaptcha _captcha =
null
;
protected
RadCaptcha MyCaptcha
get
if
(!SystemManager.IsDesignMode)
foreach
(var control
in
this
.FormControls.Controls[1].Controls)
if
(control.GetType() ==
typeof
(RadCaptcha))
_captcha = control
as
RadCaptcha;
break
;
return
_captcha;
private
string
_captchaErrorMessage =
"Invalid Code, please try again"
;
/// <summary>
/// This gets edited in advanced mode
/// </summary>
public
string
CaptchaErrorMessage
get
return
_captchaErrorMessage;
set
_captchaErrorMessage = value;
#endregion
The Sitefinity Hero strikes again! Thank you Steve
**JUST KEEP IN MIND**
If you have a form on an existing page, you'll need to delete the control, and then re-drag it from the toolbox. Reason being is the one on the page IS the "FormsControl" not my enhanced "FormCaptcha"
Hello,
Thank you Steve for sharing a solution.
Regards,
Stefani Tacheva
Telerik