How to translate TextBox error messages.

7 posts, 1 answers
  1. Jacek
    Jacek avatar
    18 posts
    Member since:
    Apr 2011

    Posted 02 Aug 2018 Link to this post

    Just like in title, I am using TextBox set as numeric. I would like to translate error messages like "Please  enter a number."
  2. Rumen
    Admin
    Rumen avatar
    14163 posts

    Posted 03 Aug 2018 Link to this post

    Hello Jacek,

    Can you please double check whether the "Please enter a number" string is not part of some ASP validator, but not of RadNumericTextBox?

    I searched in the source code of the Telerik UI for ASP.NET AJAX components and was unable to find such a string in the code of RadNumericTextBox. 

    Please provide the RadNumericTextBox configuration and a screenshot of the page where the "Please enter a number" error pops up.

    Best regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Jacek
    Jacek avatar
    18 posts
    Member since:
    Apr 2011

    Posted 03 Aug 2018 Link to this post

    Thank you for fast answer,

    nothing special in code, just like this:

    <telerik:RadTextBox ID="tNumer" runat="server" Label="NUMER ZLECENIA : " LabelWidth="200px" Width="350px" Skin="Bootstrap" InputType="Number" Resize="None">
        <EmptyMessageStyle Resize="None" />
        <ReadOnlyStyle Resize="None" />
        <FocusedStyle Resize="None" />
        <DisabledStyle Resize="None" />
        <InvalidStyle Resize="None" />
        <HoveredStyle Resize="None" />
        <EnabledStyle Resize="None" />
    </telerik:RadTextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tNumer" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
    <br />

     

    Attached file contains message.

     

     

  4. Rumen
    Admin
    Rumen avatar
    14163 posts

    Posted 03 Aug 2018 Link to this post

    Hi,

    The tooltip shown in the screenshot is not built-in in RadTextBox. Do you have a RadTooltip or another tooltip control on the page as well as a custom validator with text  "Please enter a number."?

    Can you provide the page and its codebehind to check it?

    Best regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Jacek
    Jacek avatar
    18 posts
    Member since:
    Apr 2011

    Posted 03 Aug 2018 Link to this post

    Codebehind is empty yet, whole aspx page as follows:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Wynik.aspx.cs" Inherits="App.Wynik" %>
     
    <!DOCTYPE html>
     
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
     
        <link href="site.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                    </asp:ScriptReference>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                    </asp:ScriptReference>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
                    </asp:ScriptReference>
                </Scripts>
            </telerik:RadScriptManager>
    <div class="center">
                <asp:Panel ID="Panel1" runat="server" BorderStyle="Solid" BorderWidth="5px" CssClass="RadForm rfdTextbox" Height="400px" HorizontalAlign="Center" Width="450px" BorderColor="#00DBB2">
                    <br />
                    <telerik:RadTextBox ID="tNumer" runat="server" Label="NUMER ZLECENIA : " LabelWidth="200px" Width="350px" Skin="Bootstrap" InputType="Number" Resize="None">
                        <EmptyMessageStyle Resize="None" />
                        <ReadOnlyStyle Resize="None" />
                        <FocusedStyle Resize="None" />
                        <DisabledStyle Resize="None" />
                        <InvalidStyle Resize="None" />
                        <HoveredStyle Resize="None" />
                        <EnabledStyle Resize="None" />
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tNumer" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                    <br />
                    <telerik:RadTextBox ID="tPesel" runat="server" Label="PESEL : " LabelWidth="200px" TextMode="Password" Width="350px" Skin="Bootstrap">
                        <EmptyMessageStyle Resize="None" />
                        <ReadOnlyStyle Resize="None" />
                        <FocusedStyle Resize="None" />
                        <DisabledStyle Resize="None" />
                        <InvalidStyle Resize="None" />
                        <HoveredStyle Resize="None" />
                        <EnabledStyle Resize="None" />
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tPesel" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                    <br />
                    <telerik:RadTextBox ID="tPIN" runat="server" Label="NUMER PIN : " LabelWidth="200px" TextMode="Password" Width="350px" Skin="Bootstrap">
                        <EmptyMessageStyle Resize="None" />
                        <ReadOnlyStyle Resize="None" />
                        <FocusedStyle Resize="None" />
                        <DisabledStyle Resize="None" />
                        <InvalidStyle Resize="None" />
                        <HoveredStyle Resize="None" />
                        <EnabledStyle Resize="None" />
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="tPIN" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
     
                    <telerik:RadCaptcha ID="RadCaptcha1" runat="server" CaptchaLinkButtonText="odśwież" CaptchaTextBoxLabel="Przepisz kod" Skin="Bootstrap" Width="200px" CssClass="nowyStyl1" EnableRefreshImage="True" EnableMissingPluginNotification="True" RenderMode="Lightweight">
                        <TextBoxDecoration AccessKey="" BackColor="" BorderColor="" BorderStyle="NotSet" BorderWidth="" CssClass="" ForeColor="" Height="" TabIndex="0" ToolTip="" Width="160px" />
                        <TextBoxLabelDecoration AccessKey="" BackColor="" BorderColor="" BorderStyle="NotSet" BorderWidth="" CssClass="" ForeColor="" Height="" TabIndex="0" ToolTip="" Width="250px" />
                    </telerik:RadCaptcha>
     
     
                    <telerik:RadImageButton ID="RadImageButton1" runat="server" OnClick="RadImageButton1_Click" Text="Pokaż wynik" Width="150px">
                    </telerik:RadImageButton>
                    <br />
                    <asp:Label ID="lMsg" runat="server" ForeColor="#990000"></asp:Label>
                </asp:Panel>
            </div>
        </form>
    </body>
    </html>
  6. Answer
    Rumen
    Admin
    Rumen avatar
    14163 posts

    Posted 03 Aug 2018 Link to this post

    Hello,

    Thank you for the sample!

    I examined it and found that this is the default Firefox browser tooltip for inputs of type="number". 

    You can reproduce the same behavior with a regular ASP:Button with applied type="Number" attribute:

    <asp:TextBox ID="tNumer" runat="server" Label="NUMER ZLECENIA : " LabelWidth="200px" Width="350px" Skin="Bootstrap" type="Number" Resize="None"></asp:TextBox>

    The localization of the tooltip is depends on the browser localization and is not controlled by Telerik. You can find information of how to change the text in StackOverflow: https://stackoverflow.com/questions/10753881/changing-the-language-of-error-message-in-required-field-in-html5-contact-form.

    Regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Jacek
    Jacek avatar
    18 posts
    Member since:
    Apr 2011

    Posted 03 Aug 2018 Link to this post

    You are right,

    Chrome do not allow to input any other character then number, but Firefox allow any char, then when page reloads validates component.

     Thank you for fast and accurate help.

    Jacek.

     

Back to Top