Validation display location?

7 posts, 0 answers
  1. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 18 Jun 2009 Link to this post

    Hi Telerekians!

    I had one little request... is there a way to control where the validation text appears?  Currently it is displaying above and below the control, but I'd rather be able to pick one or the other.  Is that possible/going to be possible?

    Thank you!
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 23 Jun 2009 Link to this post

    Hello Serrin,


    At the moment it is not possible to set where the error message should be displayed. However, because RadCaptcha should behave as a page validator (the user can choose where to display the error message of any validator) this functionality will be implemented for the official release. 

    Kind regards,
    Pero
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pradeep Enugala
    Pradeep Enugala avatar
    55 posts
    Member since:
    Apr 2010

    Posted 27 May 2010 Link to this post

    Hi,
       I would like to know whether this issue has been resolved.
       Currently I have a radcaptcha and I am settting CaptchaImage-RenderImageOnly to true. And I am providing ValidatedTextBoxID a value txt_CaptchaAnswer and I would like to display the error message next to the txt_CaptchaAnswer textbox.

    Below is the code for captcha and textbox.
    <telerik:RadCaptcha ID="rad_Captcha" runat="server" ValidationGroup="vgRegistration" EnableRefreshImage="true" CaptchaImage-RenderImageOnly="true" ValidatedTextBoxID="txt_CaptchaAnswer" ErrorMessage="Entered code is not correct">

    <asp:TextBox ID="txt_CaptchaAnswer" runat="server" Width="135"></asp:TextBox>

    At present the error message is getting displayed at the top of captcha. I would like to display the error message next to the textbox. Your help is highly appreciated.

    Regards,
    Pradeep.
  5. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 01 Jun 2010 Link to this post

    Hi Pradeep,

    This can be easily achieved by placing a Label control right next to the validated TextBox, and set the text of the Label to the Captcha's ErrorMessage, as shown in the following project:
    .aspx
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            </Scripts>
        </asp:ScriptManager>
        <div>
            <telerik:RadCaptcha ID="RadCaptcha1" runat="server" Display="None" ErrorMessage="Please enter the code shown correctly."
                ForeColor="Brown" ValidatedTextBoxID="txtCaptcha">
                <CaptchaImage RenderImageOnly="true" />
            </telerik:RadCaptcha>
            <asp:TextBox ID="txtCaptcha" runat="server" MaxLength="5"></asp:TextBox>
            <asp:Label ID="errorMessage" runat="server" EnableViewState="false"></asp:Label><br />
            <asp:Button ID="Button1" runat="server" Text="Verify Code" OnClick="Button1_Click" />
        </div>
        </form>
    </body>
    </html>

    .cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    public partial class Captcha_Default_Captcha : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            errorMessage.Text = string.Empty;
        }
     
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (!RadCaptcha1.IsValid)
            {
                errorMessage.ForeColor = RadCaptcha1.ForeColor;
                errorMessage.Text = RadCaptcha1.ErrorMessage;
            }
        }
    }


    Best wishes,
    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.
  6. Pradeep Enugala
    Pradeep Enugala avatar
    55 posts
    Member since:
    Apr 2010

    Posted 02 Jun 2010 Link to this post

    Pero,
       Thank you very much for the help. Your solution resolved my issue.
    Pradeep.
  7. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    Hi All, I'd like to know if a solution to Serrin's original question has been implemented?

    I too have set a ValidationGroup for my Capcha control, as required, but when a user enters an incorrect code, both the Capcha control and the ValidationSummary show the error. As my user is required to enter additional fields, I need to use the ValidationSummary (so all error messages are shown in the same place) and can't see any reason for the Capcha control to display the message aswell.

    Can this be "turned off" or made switchable, so that either the Capcha control or ValidationSummary control display the message, or both, or neither!
  8. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    After a little more digging I've found it...

    Set Display="None" on the Capcha control
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017