Display successful client side validation?

2 posts, 0 answers
  1. DH
    DH avatar
    11 posts
    Member since:
    Dec 2011

    Posted 29 Nov 2014 Link to this post

    Its relatively easy to do client-side validation and display an error message, however it seems difficult to show a success message in a simple / easy way.

    It seems like the only way to do this is to write a bit of javascript that hooks into the ClientEvents-OnBlur(), then have this function check validity again, and apply the proper class, correct? 

    Does anyone have a working example?
  2. Viktor Tachev
    Viktor Tachev avatar
    1443 posts

    Posted 03 Dec 2014 Link to this post


    In order to indicate successful validation you can use JavaScript. Check out the following code-snippets that illustrate an approach you could use. It includes a CustomValidator control:


    <telerik:RadTextBox runat="server" ID="TextBox1" />
    <asp:CustomValidator ControlToValidate="TextBox1" runat="server" ValidateEmptyText="true" EnableClientScript="true" ClientValidationFunction="clientValidate" />


    function clientValidate(sender, args) {
        if (args.Value.indexOf("test") != -1) {
            args.IsValid = true;
            document.getElementById("validStatus").innerHTML = "Valid";
            document.getElementById("validStatus").style.color = "#00dd00";
        } else {
            args.IsValid = false;
            document.getElementById("validStatus").innerHTML = "Not Valid";
            document.getElementById("validStatus").style.color = "#ff0000";

    Viktor Tachev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top