Captcha control in a login control

11 posts, 0 answers
  1. Sameh Awad
    Sameh Awad avatar
    1 posts
    Member since:
    Sep 2009

    Posted 07 Nov 2009 Link to this post

    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
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 11 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter Parsons
    Peter Parsons avatar
    14 posts
    Member since:
    Sep 2008

    Posted 08 Dec 2009 Link to this post

    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
  5. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 09 Dec 2009 Link to this post

    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.
  6. Waqas Aslam
    Waqas Aslam avatar
    8 posts
    Member since:
    Oct 2009

    Posted 16 Dec 2009 Link to this post

    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...
  7. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 17 Dec 2009 Link to this post

    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.
  8. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 24 Mar 2010 Link to this post

    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
  9. Waqas Aslam
    Waqas Aslam avatar
    8 posts
    Member since:
    Oct 2009

    Posted 24 Mar 2010 Link to this post

    using UniqueId of your custom text box in the captcha control should resolve the issue...
  10. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 24 Mar 2010 Link to this post

    I've tried that but still no joy unfortunately.
  11. Waqas Aslam
    Waqas Aslam avatar
    8 posts
    Member since:
    Oct 2009

    Posted 25 Mar 2010 Link to this post

    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.
  12. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 29 Mar 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017