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

Captcha control in a login control

10 Answers 343 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Sameh Awad
Top achievements
Rank 1
Sameh Awad asked on 07 Nov 2009, 08:41 AM
Hi,

I am trying to use the captcha control inside a login control. I also changed the username and password textboxes to Radtextbox. I added another RadTextBox to act as the Validated textbox of the Captcha control (since the captcha control uses a normal input box not a Rad). I also added a validation summary.
My problem is when I click the log in button after entering the username, password and the image code, The image refreshes, the validated text box remains the same code entered for the old image and the validation summary returns an error the code doesn't match the image. I tried clearing the text box after but the same error from the validation summary is still the same. This prevents the form from actually submitting.

I hope I explained my problem clearly.

Best regards,
Sameh

10 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 11 Nov 2009, 11:53 AM
Hi Sameh,

The RadCaptcha can validate only asp:TextBox control. That is why you are having the problem when trying to validate the input from a RadTextBox.

Please use asp:TextBox and let me know if you still experience problems.


Regards,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Peter Parsons
Top achievements
Rank 1
answered on 08 Dec 2009, 10:01 AM
Hi,

I am having a similar problem, but am using an asp:textbox inside the add user wizard.

The RadCaptcha is inside the AddUser template but will not validate when using ValidatedTextBoxID and an asp:textbox. The only way I can get it working is with the built in textbox.

Alternatively, is there anyway to adjust the layout of the RadCaptcha?

I am using the latest build.

Cesare
0
Pero
Telerik team
answered on 09 Dec 2009, 08:45 AM
Hello Cesare,

I believe the problem is caused by the fact that the RadCaptcha cannot find the custom TextBox, because it is not in the naming container of the Page. The problem can be avoided by specifying the UniqueID of the TextBox to the ValidatedTextBoxID property of the RadCaptcha.

For example in the attached sample project I have specified the UniqueID of the TextBox placed inside a telerik:RadPanelItem. It works as expected.

Kind regards,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Waqas Aslam
Top achievements
Rank 2
answered on 16 Dec 2009, 01:16 PM
can you please elaborate why do we need to provide textbox's uniqueId to captcha in order to validate correctly?
i was also having the same problem but once i provided custom textbox's uniqueId to captcha, it worked fine. but still i do not understand the reason of doing irrelevant work...
0
Pero
Telerik team
answered on 17 Dec 2009, 08:02 AM
Hello Waqas,

Initially the Captcha control was designed to look for the custom validated textbox in the NamingContainer of the Page (i.e. Page.FindControl(TextBoxID) ). The goal was to support scenarios when the RadCaptcha and custom validated textbox are in different NamingContainers (i.e. the RadCaptcha is in the NamingContainer of the Page and the TextBox is in the NamingContainer of a login control). This on the other hand introduced a "problem" when the TextBox is not in the Page's NamingContainer - the RadCaptcha cannot find the custom textbox and its UniqueID has to be supplied in order for the textbox to be found.

Because it is very unlikely that the Captcha control and the validated asp:TextBox to be in different NamingContainers, we have changed the code so that RadCaptcha searches the current NamingContainer (i.e. in the case with the login control - the NamingContainer of the login control). This way only the ID needs to be supplied and the TextBox will be found correctly. The fix has been in the latest internal build and you should download and test it in your project.


Best wishes,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
John Martin
Top achievements
Rank 2
answered on 24 Mar 2010, 01:54 PM
Hi,

I'm having the same issue. I'm using version 2010.1 309.35. My login control is within a master page with Script & RadAjaxmanger on the master page.

Anyone have any ideas???


Cheers

Mark
0
Waqas Aslam
Top achievements
Rank 2
answered on 24 Mar 2010, 02:24 PM
using UniqueId of your custom text box in the captcha control should resolve the issue...
0
John Martin
Top achievements
Rank 2
answered on 24 Mar 2010, 04:42 PM
I've tried that but still no joy unfortunately.
0
Waqas Aslam
Top achievements
Rank 2
answered on 25 Mar 2010, 08:07 AM
another way could be using the control's ID by viewing into the source code of your rendered aspx page in browser. simply locate the textbox's ID (something like ctl00$ContentControl$txtBox) and define it in the ValidatedTextBoxID of captcha.
actually this is how i've done in my project and it works for me.
0
Pero
Telerik team
answered on 29 Mar 2010, 10:59 AM
Hello Mark,

As stated in my previous post, you only need to supply the ID of the asp:TextBox, when using the latest official release. Please note that, the Captcha and the TextBox should be in the same NamingContainer, in order for the input to be validated correctly.


Regards,
Pero
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Captcha
Asked by
Sameh Awad
Top achievements
Rank 1
Answers by
Pero
Telerik team
Peter Parsons
Top achievements
Rank 1
Waqas Aslam
Top achievements
Rank 2
John Martin
Top achievements
Rank 2
Share this question
or