6.3.5024 captcha custom char set
It seems I am blind again.
I want to set the characters to be used in the captcha of my for myself. I dont like it when i have 0 O l I (one is an captital i the other a lowercase L)
But I simply cant find it were to set. I went into edit - advaced - captcha but cant find it.
Any one can help me? I guess I simply overlook it somehow.
demos.telerik.com/.../defaultcs.aspx
Markus
Hello,
You need to create a new Form Captcha control which inherit from the default FormCaptcha. Then you need to change the captcha image char set and register the control.
Custom For Captcha:
public
class
CustomFormCaptcha : FormCaptcha
public
string
CharSet
get
;
set
;
protected
override
string
ScriptDescriptorTypeName
get
return
typeof
(FormCaptcha).FullName;
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
base
.InitializeControls(container);
if
(!
string
.IsNullOrEmpty(
this
.CharSet))
this
.Captcha.CaptchaImage.TextChars = CaptchaPossibleChars.CustomCharSet;
this
.Captcha.CaptchaImage.CharSet =
this
.CharSet;
else
this
.Captcha.CaptchaImage.TextChars = CaptchaPossibleChars.LettersAndNumbers;
Could you open up another feature request (more like a bug)
The captcha is not localizable. Neither by Administration- Label & Messages nor by setting the text in advanced mode. So for now it seems I am stuck with english captchas on all my pages.
I wonder why default RadControls stuff is not exposed.
Markus
Support opened a feedback entry for this.
Anyone using multilingual sites and forms captchas and feels like voting?
feedback.telerik.com/.../125592-form-captcha-control-localizable
Strange enough the captcha on comments is localized :-(
Markus
Hi,
As you mentioned we have opened a feature request about this missing functionality which description could be found in our Feedback portal on the following link. However you could achieve the desired functionality using some customizations. I am sharing our solution with the community as well:
You can apply the approaches described in the following articles:
https://demos.telerik.com/aspnet-ajax/captcha/examples/localization/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/captcha-localization.html
Here is a sample on how you can plug in your logic and alter the text:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
Telerik.Sitefinity.Modules.Forms.Web.UI.Fields;
namespace
SitefinityWebApp
public
class
CustomFormsCaptcha : FormCaptcha
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
this
.Captcha.CaptchaLinkButtonText =
"This is the custom link"
;
this
.Captcha.CaptchaTextBoxLabel =
"This is custom label"
;
base
.InitializeControls(container);
Hi,
I tried to add this code you posted above but I get Uncaught ReferenceError. See attached file.
Regards,
Dejan Pecnik
Hello,
It seems that your project name is different. Please create a new class called
CustomFormsCaptcha
in your project and include the following code inside it:
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
this
.Captcha.CaptchaLinkButtonText =
"This is the custom link"
;
this
.Captcha.CaptchaTextBoxLabel =
"This is custom label"
;
base
.InitializeControls(container);
Hello,
I tried to create a new class but there is no difference. I can add control in the backend and it looks like it works well, but when I publish form and reopen it an error occurs.
Regards,
Dejan Pecnik
Hello Dejan,
You should add the ScriptDescriptorType of the control to the FormCaptcha, so all other resources will be loaded from it:
protected
override
string
ScriptDescriptorType
get
return
typeof
(FormCaptcha).FullName;
Thanks Nikola. This is solved my problem.
Regars,
Dejan Pecnik