More in this section

Forums / Bugs & Issues / How to set the validation of CAPTCHA in the registration form?

How to set the validation of CAPTCHA in the registration form?

2 posts, 0 answered
  1. wing
    wing avatar
    10 posts
    25 Nov 2013
    29 Nov 2013
    Link to this post
    HI everyone,

    I need some help. I can show the CAPTCHA in the registration form 
    but I cannot  do the validation I wanted. I want to validate the CAPTCHA before finished the registration.

    <sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("emailNotice")%>' /><%@ Control Language="C#" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Fields" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sfvalidation" Namespace="Telerik.Sitefinity.Web.UI.Validation.Definitions" Assembly="Telerik.Sitefinity"%>

    <fieldset class="sfregisterFormWrp">
        <asp:Panel ID="formContainer" runat="server" DefaultButton="registerButton">
            <ol class="sfregisterFieldsList">
                <sf:TextField ID="firstName" runat="server" DataFieldName="FirstName" DataItemType="Telerik.Sitefinity.Security.Model.SitefinityProfile" DisplayMode="Write" Title="Name" CssClass="sfregisterField sfregisterFirstName" WrapperTag="li" />
                <sf:TextField ID="email" runat="server" DataFieldName="Email" DisplayMode="Write" Title="<%$ Resources:Labels, Email %>" CssClass="sfregisterField sfregisterEmail" WrapperTag="li">
                    <ValidatorDefinition MessageCssClass="sfError" Required="true" ExpectedFormat="EmailAddress"/>
                <sf:TextField ID="userName" runat="server" DataFieldName="UserName" DisplayMode="Write" Title="<%$ Resources:Labels, UserName %>" CssClass="sfregisterField sfregisterUserName" WrapperTag="li">
                    <ValidatorDefinition MessageCssClass="sfError" Required="true"/>
                <sf:TextField ID="password" runat="server" DisplayMode="Write" Title="<%$ Resources:Labels, Password %>" IsPasswordMode="true" CssClass="sfregisterField sfregisterPassword" WrapperTag="li">
                    <ValidatorDefinition MessageCssClass="sfError" Required="true"/>

                <sf:TextField ID="reTypePassword" runat="server" DisplayMode="Write" Title="<%$ Resources:UserProfilesResources, ReTypePassword %>" IsPasswordMode="true" CssClass="sfregisterField sfregisterConfirmPassword" WrapperTag="li">
                    <ValidatorDefinition MessageCssClass="sfError">
                            <sfvalidation:ComparingValidatorDefinition ControlToCompare="password"
                                Operator="Equal" ValidationViolationMessage="<%$ Resources:ErrorMessages, CreateUserWizardDefaultConfirmPasswordCompareErrorMessage %>"/>

              <telerik:RadCaptcha ID="captcha" runat="server" ValidationGroup="Group" ErrorMessage="Page not valid. The code you entered is not valid." ForeColor="red" EnableRefreshImage="true" CaptchaLinkButtonText="Refresh"
               CaptchaTextBoxCssClass="txtCaptcha" CaptchaTextBoxLabelCssClass="lblCaptcha"></telerik:RadCaptcha>


            <asp:Panel ID="errorsPanel"  runat="server" CssClass="sfErrorSummary" Visible="false"/>
            <div class="sfregisterLnkWrp" >
                <asp:Button runat="server" ID="registerButton" ValidationGroup="Group" Text="<%$ Resources:UserProfilesResources, Register %>" CssClass="sfregisterSaveLnk"/>
        <sf:SitefinityLabel id="successMessageLabel" runat="server" WrapperTagName="div" CssClass="sfSuccess" />
        <asp:Panel ID="configurationErrorsPanel" runat="server" CssClass="sfErrorSummary" Visible="false" >
            <div runat="server" id="smtpSettingsErrorWrapper" Visible="false">
                <asp:Label runat="server" id="smtpConfigurationErrorTitle" Text="<%$ Resources:ErrorMessages, CannotSendEmails %>"/>
                <asp:Label runat="server" id="smtpConfigurationError"></asp:Label>


  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    21 Jan 2015
    02 Dec 2013
    Link to this post

    RadCaptcha is implemented in Forms module since 6.2. You could create a registration form using the form builder and add Captcha easily.

    The approach for adding Captcha to a registration widget is by making a custom widget replacing the original one. Please find the control attached. For your convenience I also have recorded a short video to demonstrate the whole process of implementation:

    As you can see from the video the widget does not need any configurations in order to work properly. In my case I have registered the widget directly in the ToolboxesConfig.config file, but you can register it from the backend.

    In case you want to implement Captcha for versions prior to 6.2 using form builder, please refer to this blogpost:

    Vassil Vassilev
    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
2 posts, 0 answered