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

Validation display location?

6 Answers 193 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Serrin
Top achievements
Rank 1
Serrin asked on 18 Jun 2009, 08:28 PM
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!

6 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 23 Jun 2009, 11:26 AM
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.
0
Pradeep Enugala
Top achievements
Rank 1
answered on 27 May 2010, 11:05 AM
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.
0
Pero
Telerik team
answered on 01 Jun 2010, 01:11 PM
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.
0
Pradeep Enugala
Top achievements
Rank 1
answered on 02 Jun 2010, 07:51 AM
Pero,
   Thank you very much for the help. Your solution resolved my issue.
Pradeep.
0
Karl
Top achievements
Rank 1
answered on 11 Nov 2010, 02:26 PM
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!
0
Karl
Top achievements
Rank 1
answered on 11 Nov 2010, 03:12 PM
After a little more digging I've found it...

Set Display="None" on the Capcha control
Tags
Captcha
Asked by
Serrin
Top achievements
Rank 1
Answers by
Pero
Telerik team
Pradeep Enugala
Top achievements
Rank 1
Karl
Top achievements
Rank 1
Share this question
or