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

Custom message for client-side validation

2 Answers 119 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 01 Jul 2010, 10:58 AM
I need to show a custom error message when the user enters too much text in a RadEditor (the default pop-up is unsuitable).  The solution suggestion by Rumen in this post works marvellously in cases where there is a single RadEditor on a page.  However, my page has three RadEditor controls, and I would like to show a different message for each of them.  Is this possible?

All advice gratefully received,

Ed Graham

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 01 Jul 2010, 01:22 PM
Hi Ed,

Here is an example on how to modify the code to work for multiple editors:

<telerik:RadEditor MaxTextLength="10"  runat="server" Height="200" ID="RadEditor1"><Content>dassssssasdasda dsasdasda dsdasdasddasds</Content></telerik:RadEditor>
<telerik:RadEditor MaxTextLength="20"  runat="server" Height="200" ID="RadEditor2"><Content>dassssssasdasda dsasdasda dsdasdasddasds</Content></telerik:RadEditor>
<telerik:RadEditor MaxTextLength="15"  runat="server" Height="200" ID="RadEditor3"><Content>dassssssasdasda dsasdasda dsdasdasddasds</Content></telerik:RadEditor>
<div id="counter"></div>
<script type="text/javascript">
    Telerik.Web.UI.RadEditor.prototype.displayMaxTextLengthErrorMessage = function() {
            $get("counter").innerHTML += "You are not allowed to type more than " + this.get_maxTextLength() + " symbols in " + this.get_id() + "<br/>";
    }
</script>
<asp:Button ID="btn_test" Text="Test" runat="server" />


Greetings,
Rumen
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
Ed
Top achievements
Rank 1
answered on 01 Jul 2010, 02:59 PM
Thanks a lot, Rumen -- that did the trick.
Tags
Editor
Asked by
Ed
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ed
Top achievements
Rank 1
Share this question
or