RadTextBox emptyMessage is still there on focussing

8 posts, 0 answers
  1. Bala
    Bala avatar
    11 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post

    Hi,

    I set a textbox to be focussed from server side inside the IsPostBack event as txtUserName.Focus(). Once the page gets rendered completely my focus is retained in that control but the empty mesage in that textbox is still there. My empty message is still there as normal text so once if i start typing the text also the empty message is still there like this,
    If my empty message is like "Enter user name" and if i start typing it is like "adminEnter user name".

    Rest of the textbox in the page is working as per functionality but only if i set focus to a textbox that textbox alone looses the style,,,

    Any help......
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 03 Sep 2012 Link to this post

    Hi Bala,

    Could you please try to achieve this on client side and let me know about the result?
    function pageLoad() {
         var isPostBack = '<%= Page.IsPostBack ? "true" : "false" %>';
         if (isPostBack == "false") {
             document.getElementById("txtUserName").focus();
         }
     }

    That should do the trick.

    Regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steele
    Steele avatar
    58 posts
    Member since:
    Jun 2006

    Posted 21 Sep 2012 Link to this post

    I recently upgraded a client to 2012.2.815.40.
    This workaround is not working for me in ALL Browsers (IE7 specifically)
    and there are some old bugs that have resurfaced, hitting escape a couple times in IE9 (9.0.8112.16421) reveals and retains the EmptyMessage as the input's value.
    Notice that Last Name in the attached image shows the Empty Message as the value (black instead of grey like First Name) after hitting Escape twice then mousing to the Requestor ID field.
    Hopefully there is a fix already in the works.
    Thanks,

    Steele Price
  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 26 Sep 2012 Link to this post

    Hi Steele,

    Please note that this is the default IE browser behavior and it is not specific to RadInput. For example you could try with a regular asp:TextBox:
    <asp:TextBox ID="TextBox1" runat="server" Text="test"></asp:TextBox>

    As for the focusing issue, I am afraid I could not replicate it on my end. The suggested approach also works correctly on IE7. Please provide us the steps to reproduce the problem.

    Kind regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 09 May 2014 Link to this post

    Hi Everyone,

    I have the same problem that Bala says.
    My style is totally lost, and the emptymessage never disappears, it´s necessary erase manually.
    This is my code:

    <telerik:RadTextBox ID="c_nome" runat="server" EmptyMessage="Inform name..." Skin="Sunset" Width="98%" Font-Size="Medium" Font-Bold="true" FocusedStyle-BorderWidth="1px" FocusedStyle-ForeColor="DarkBlue" ForeColor="DarkBlue" ValidationGroup="ContatoValidationGroup" >
                                <FocusedStyle Resize="None" BorderWidth="2px" ForeColor="DarkBlue"></FocusedStyle>
                                <ClientEvents OnBlur="testa_saida" />
                            </telerik:RadTextBox>

    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                                            ControlToValidate="c_email" ErrorMessage="E-Mail Inválido!" ValidationGroup="ContatoValidationGroup" SetFocusOnError="True"
                                                            ToolTip="E-Mail" Display="Dynamic" ForeColor="Red" Font-Size="Medium" Font-Bold="true" 
                                                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
                                *&nbsp;
                            </asp:RegularExpressionValidator>

    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="c_email"
                                                        ErrorMessage="Informar E-Mail!" ValidationGroup="ContatoValidationGroup" SetFocusOnError="True"
                                                        ToolTip="E-Mail" Display="Dynamic" ForeColor="Red" Font-Size="Medium" Font-Bold="true" >
                                *&nbsp;
                            </asp:RequiredFieldValidator>E-mail:
    <telerik:RadTextBox ID="c_email" runat="server" EmptyMessage="Informe..." Skin="Sunset" Width="98%" Font-Size="Medium" Font-Bold="true" FocusedStyle-BorderWidth="1px" FocusedStyle-ForeColor="DarkBlue" ForeColor="DarkBlue" ValidationGroup="ContatoValidationGroup" >
                                <EmptyMessageStyle Resize="None"></EmptyMessageStyle>

                                <FocusedStyle Resize="None" BorderWidth="1px" ForeColor="DarkBlue"></FocusedStyle>

                                <ClientEvents OnBlur="testa_saida" />
                            </telerik:RadTextBox>


    JS CODE
    function testa_saida(sender, eventArgs) {
                            msg = "";
                            var_id = sender.get_id();
                            var_content = sender.get_value();
                            var vNome_var = var_id.split("_").pop();
                            if (vNome_var == "email")
                                vdrop = true;
                            //Validação do nome e email
                            if (var_content == "") {
                                msg += "<br/><br/>" + "&nbsp;&nbsp;&nbsp;>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
                                if (vNome_var == "nome")
                                    msg += "NOME".bold();
                                else if (vNome_var == "email")
                                    msg += "E-MAIL".bold();
                            }

                            if (msg == "") {
                                return true;
                            }
                            else {                        
                                var notification = $find("<%= aviso_nok.ClientID %>");
                                var vmessage = "POR FAVOR, INFORME:\n" + msg;
                                notification.set
                                notification.set_text(vmessage);
                                notification.show();

                                if (vNome_var == "nome")
                                    setfocus_nome();
                                else if (vNome_var == "email")
                                    setfocus_email();

                                return false;
                            }
                        }
    function setfocus_nome(sender, eventArgs) {
                            var txt = $find("<%=c_nome.ClientID %>");
                            txt.focus();
                        }

                        function setfocus_email(sender, eventArgs) {
                            var txt = $find("<%=c_email.ClientID %>");
                            txt.focus();
                        }

    Thanks,

    Daniel
  7. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 14 May 2014 Link to this post

    Hello Daniel,

    I have created a sample RadGrid web site using the provided code snippets to test the described behavior. On my side focusing the input is working as expected and the empty message is correctly removed. Please run the attached application and let me know about the result.

    Regards,
    Eyup
    Telerik
     

    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.

     
  8. cdikmen
    cdikmen avatar
    25 posts
    Member since:
    Aug 2006

    Posted 07 Apr 2015 Link to this post

    I am having this problem, but only on one page of my website. The RadTextBox Empty Message works correctly on all pages except for one. Obviously, it would appear there is something on that page conflicting with the RAD TextBox, but what?

    I have some RadTextBox fields in a UserControl that is embedded on several pages.

    I am stumped on this one. Any suggestions on what I should look for?

  9. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 10 Apr 2015 Link to this post

    Hello,

    You can temporarily disable any ajaxification on the page and enable your script debugger (FireBug or F12) to see whether there are any script errors interfering.

    Hope this helps.

    Regards,
    Eyup
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017