This is a migrated thread and some comments may be shown as answers.
RadTextBox emptyMessage is still there on focussing
7 Answers 77 Views
This is a migrated thread and some comments may be shown as answers.
Bala
Top achievements
Rank 1
Bala asked on 29 Aug 2012, 09:21 AM
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......

7 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Sep 2012, 07:56 AM
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.
0
Steele
Top achievements
Rank 1
answered on 21 Sep 2012, 11:52 PM
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
0
Eyup
Telerik team
answered on 26 Sep 2012, 10:37 AM
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.
0
Daniel Aquere
Top achievements
Rank 2
answered on 09 May 2014, 07:22 PM
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
0
Eyup
Telerik team
answered on 14 May 2014, 10:50 AM
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.

 
0
cdikmen
Top achievements
Rank 1
answered on 07 Apr 2015, 12:40 PM

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?

0
Eyup
Telerik team
answered on 10 Apr 2015, 09:01 AM
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.

 
Tags
Input
Asked by
Bala
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Steele
Top achievements
Rank 1
Daniel Aquere
Top achievements
Rank 2
cdikmen
Top achievements
Rank 1
Share this question
or