This is a migrated thread and some comments may be shown as answers.

captcha without textbox validation how?

1 Answer 152 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 17 Aug 2011, 04:06 PM
I am using Telerik captcha control without textbox and now i want to validate this with my own textbox value.

my code is this

    <telerik:RadCaptcha ID="RadCaptcha" runat="server" EnableRefreshImage="true" CaptchaTextBoxCssClass="text"
                                                                    ProtectionMode="Captcha" Display="Dynamic" ErrorMessage="Invaid Code" CaptchaImage-TextColor="Black"
                                                                    CaptchaImage-RenderImageOnly="true" CaptchaImage-Width="219" CaptchaImage-TextChars="CustomCharSet"
                                                                    CaptchaImage-CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
                                                                    CaptchaImage-ImageCssClass="captchIMG" CaptchaImage-Height="36" CaptchaImage-BackgroundNoise="None"
                                                                    CaptchaImage-LineNoise="High" />

and a single seperate text box for validate its value

    <asp:TextBox ID="txtCaptcha" runat="server" CssClass="text" />

Now on button click event i want to validate this captcha text but how???

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 18 Aug 2011, 01:02 PM
Hi Gaurav,

Please follow these suggestions in order to achieve the desired functionality:

1. The property ValidationGroup of the RadCaptcha and the button, that triggers postback, should have the same value.

2. The ValidatedTextBoxID property of RadCaptcha should be set to the ID of the TextBox which you want to be validated. This is demonstrated in the following online demo: http://demos.telerik.com/aspnet-ajax/captcha/examples/refreshimage/defaultcs.aspx.

3. In the button's click event handler, you can use the IsValid property of RadCapthca to validate the input for the captcha. In this online demo you can check a scenario, in which the IsValid property is used.

I would also suggest the Getting Started help article, which contains useful information on utilizing the RadCapthca control.

You can find attached a sample page, implementing the desired functionality. Please use it as a base for your further development.

Kind regards,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Captcha
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or