1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Is there no Captcha for Forms?

Is there no Captcha for Forms?

15 posts, 1 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    23 Jan 2011
    Link to this post
    How do I get a Captcha going on the forms, and\or only allow submissions by registered(logged in) users?
  2. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    23 Jan 2011
    Link to this post
    Hey Steve,

    First point, a Captcha form widget should exist.  I'll confirm that it's on the roadmap.  From there it's just a matter of scheduling this in the midst of the hundreds of other high-priority items.  :)

    Second point, you can add your own custom Form Widgets.  Although, from what I'm seeing, our documentation of this is currently limited to a forum post.  In addition, we also have a Captcha control present in RadControls.  Because RadControls is included with Sitefinity, you could wrap this control in a form widget.

    This is all just theory though.  I haven't attempted any of this.  If you're feeling brave, take a stab at it.  Otherwise, I'm sure this will get addressed in a future Q release.

    Gabe Sumner
    Telerik | Sitefinity CMS

    Answered
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    23 Jan 2011
    Link to this post
    Thanks for the info Gabe...I was actually looking for the RadCaptcha, figured it had to be somewhere

    I'll just wait for it to be implemented into the forms engine instead of hacking in my own...I'm waiting on the forms DBtable prefix fix as well, so I'll just try and hold-off on heavy forms use anyway.
  4. JH
    JH avatar
    33 posts
    Registered:
    24 Nov 2010
    20 May 2011
    Link to this post
    Is this Captcha available in 4.1 sp1?

    Thanks,
    JH
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    23 May 2011
    Link to this post
    Hi JH,

    The feature is still not implemented. This Q we are going to extend the forms and we will try to include some validation.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Liz
    Liz avatar
    13 posts
    Registered:
    01 Mar 2011
    15 Jun 2011
    Link to this post
    Is there a workaround or code examples on how to create a custom form control with a CAPTCHA in the meantime?  It's really frustrating to see that there was a built in CAPTCHA/honey pot control in 3.x and the best answer I can find for 4.x is "Well, we'll add it to the queue for next quarter."
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    16 Jun 2011
    Link to this post
    Hi Liz,

    Here is a thread that shows how to create a custom field control. You can use similar approach to add the RadCaptcha.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Naveen
    Naveen avatar
    9 posts
    Registered:
    25 Jul 2011
    07 Sep 2011
    Link to this post
    Hi

    I tried to use RadCaptcha, Was able to add it to toolbox and Added to to Form. Now question is how to validate it? I created a Custom Form Control inheriting FormControl class and tried to validate in submit click event using captcha.IsValid but once i click submit form shows success message even if i enter wrong text in captcha.
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Sep 2011
    Link to this post
    Hi Naveen,

    The RadCaptcha validates on postback. It depends at what stage of the ASP.NET page lifecycle you check the IsValid property of the RadCaptcha, because the validation might not have been performed yet. You could try to call RadCaptcha.Validate(), and then Page.Validate().

    You can try to set some session value that indicates whether the RadCaptcha is valid which should explicitly validate the control. You can also check Page.IsValid.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  10. Naveen
    Naveen avatar
    9 posts
    Registered:
    25 Jul 2011
    08 Sep 2011
    Link to this post
    Hi Ivan
    Thanks for you reply.

    Here is what I am doing in my custom FormControl Submit button click
    protected override void ConfigureSubmitButton(System.Web.UI.Control control, string validationGroup)
            {
                var submit = control as FormSubmitButton;
                submit.Click += new EventHandler(submit_Click);
                base.ConfigureSubmitButton(control, validationGroup);
            }
     
            void submit_Click(object sender, EventArgs e)
            {
                Guid formId = this.FormId;
                FormsManager formMgr = new FormsManager();
                FormDescription formDescr = formMgr.GetForm(formId);
     
                if (this.FormControls.FindControl("Body").Controls.OfType<Telerik.Web.UI.RadCaptcha>().Count() > 0)
                {
                    RadCaptcha captcha = (RadCaptcha)this.FormControls.FindControl("Body").Controls.OfType<Telerik.Web.UI.RadCaptcha>().First();
                    captcha.ErrorMessage = "You have entered an invalid code";
                    captcha.Validate();
                    if (captcha.IsValid)
                    {
                        var smtpSettings = Config.Get<SystemConfig>().SmtpSettings;
     
                        if (!smtpSettings.Host.IsNullOrWhitespace())
                        {
                            using (SmtpClient smtpClient = new SmtpClient(smtpSettings.Host, smtpSettings.Port))
                            {
                                smtpClient.Send(
                                    "test@gmail.com",
                                    "test@gmail.com",
                                    "Test",
                                    "Test"
                                    );
                            }
                        }
                    //It sends a mail if captcha is valid and shows success message which is fine
     
                    }
                    else
                    {
                        //Now I want to write some code here to cancel Submit and show form to reenter captcha value
                       //and prevent form showing success message
     
                    }
                }
     
     
            }
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Sep 2011
    Link to this post
    Hi Naveen,

    To stop the submit you need to preform Response.Redirect in the code block ( this is the easiest way).

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  12. Naveen
    Naveen avatar
    9 posts
    Registered:
    25 Jul 2011
    16 Sep 2011
    Link to this post
    Thanks Ivan

    I Managed to fix it by commenting following line of code.
    base.ConfigureSubmitButton(control, validationGroup);
  13. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    11 Oct 2011
    Link to this post
    @Ivan

    Are we going to see captchas for forms in 4.3 or 4.4?
    Are we going to see customized validations lets say for e-mail address in forms?

    Markus
  14. Antoaneta
    Antoaneta avatar
    258 posts
    Registered:
    02 Nov 2015
    14 Oct 2011
    Link to this post
    Hi Markus,

    All the fixes and features for 4.3 release are already planned and Captcha for forms is not amongst them. I will keep you posted when we plan this feature.

    Best wishes,
    Antoaneta
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  15. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    14 Oct 2011
    Link to this post
    Thanks Antoaneta

    Sad to hear we are not getting a captcha functionality anytime soon.

    Have a nice weekend.

    Markus
15 posts, 1 answered