RadTextBox requires blur to postback value

27 posts, 0 answers
  1. Chris Dalessandri
    Chris Dalessandri avatar
    44 posts
    Member since:
    Aug 2005

    Posted 17 Nov 2012 Link to this post

    We use RadTextBoxes in a form with a countdown timer for testing purposes.  After so much time elapses, if the user has not submitted the form, it is automatically submitted for him.

    This form worked great until 1 or 2 updates ago when the RadTextBox started returning an empty value to the server on occasion.  Since the issue was sporadic we checked many other things before we finally realized it only happened when the form auto submitted.  Then we figured out it was a blur issue with RadTextBox.

    In the meantime, this has caused us major problems as examinees type in an essay for 15 minutes and then it is all gone because they were not lucky enough to click outside the RadTextBox.

    Now that we know what the problem is, we can work around it with a box.blur() or box.set_value(box.get_textBoxValue()) before postback.

    I love these controls but this behavior is a serious breaking change and makes no sense.  There should be no requirement to blur a RadTextBox to get its value to the server.

    Please fix this.

    Thank you.
  2. Chris Dalessandri
    Chris Dalessandri avatar
    44 posts
    Member since:
    Aug 2005

    Posted 19 Nov 2012 Link to this post

    We have discovered that box.blur() is not a good solution as it does not always seem to work correctly in IE9.  Likewise,  box.set_value(box.get_textBoxValue()), is not a valid solution as get_textBoxValue() will return the empty message if the user has not typed in the box.  This is contrary to the documented functionality of "Gets the string that the user typed into the text box."

    So, before I can force the value of the RadTextBox before postback I need to be able to tell if the user has typed in the box.  So, please, please, please can s
    omeone at Telerik tell me what is the recommended way to tell if a user has typed into a RadTextBox BEFORE THE RADTEXTBOX HAS BEEN BLURRED?

    Note: isEmpty() does not work for this as it seems to track value which is always the empty string before blur.

    Note2: get_textBoxValue() does not work since it will return the empty message if the user types nothing AND if the user happens to type the empty message.  In any event, this would be ridiculous solution.
     
    I am currently tracking the length of the edit text using a handler for the onKeyUp event of the dom element returned by get_element().  In the handler, I store element.value.length.  B
    ut this seems like a complicated solution for such basic functionality.

    Thank you.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 21 Nov 2012 Link to this post

    Hello Chris,

    Have you tried using the get_editValue() function of the RadTextBox, instead of get_textBoxValue()? Or does it return you the same thing?
  5. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 21 Nov 2012 Link to this post

    Hi,

    For me it makes more sense if the user tries to type "test", but he types "te" interrupted by the automatic post back server value to be null, than to get half typed one. Not a good idea to postback in the middle of user typing and treat the value as valid.

    If you need to submit the value directly on any time, use RadInputManager with asp:TextBox

    Kind regards,
    Vasil
    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. Chris Dalessandri
    Chris Dalessandri avatar
    44 posts
    Member since:
    Aug 2005

    Posted 23 Nov 2012 Link to this post

    It may make more sense to you but that is not how the text input works.  It is not how the ASP textbox server control works.  It is not how your control worked for years.  It is broken behavior.

    My users are typing long essays.  They are timed because they must be.  There is a timer on the screen that warns them that time is about to run out.  

    When someone is typing a 1000-word essay and time runs out, returning null rather than returning 999 words does make sense to anyone.

    What makes no sense to me is to build a really cool drop-in replacement for an ASP textbox that cannot perform the functions of that textbox.  

    I'm sure you guys made these changes for good reason and I really do love your controls, but I think you have gone down a bad path with this one.  Blurring is not a requirement of text inputs.  It just isn't.

    In any event, if you can just answer the question in my last post that would be helpful.

    Thank you.
  7. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 23 Nov 2012 Link to this post

    Hello Chris,

    If you prefer the asp:TextBox behaviour, then simply use asp:TextBox. You are right, we changed the behaviour, and now it is consistent for all RadInput controls like RadNumericTextBox, RadDateInput and RadMaskedTextBox. The RadTextBox should be used if you indeed need it's client side functionality. If you prefer to submit directly what is typed, then do not feel obliged to use this control.

    Greetings,
    Vasil
    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.
  8. Chris Dalessandri
    Chris Dalessandri avatar
    44 posts
    Member since:
    Aug 2005

    Posted 23 Nov 2012 Link to this post

    Hi Kevin,

    I did try get_editValue().  It does not work as I would think given the documentation.  It will return an empty string for a RadTextBox that has never been blurred.  I really do not understand how that can be but that is what my testing shows me.

    So far, the only thing that has worked for me across browsers, is to trap the onkeyup event of the DOM element returned by get_element().  At that point, you can get an actual look at what the user is typing.

    Anyway, thanks for the idea.

    Cheers.
  9. Chris Dalessandri
    Chris Dalessandri avatar
    44 posts
    Member since:
    Aug 2005

    Posted 23 Nov 2012 Link to this post

    Simply replace all the RadTextBoxes in my webapp that has been working for years with a consistent look and feel.  Why didn't I think of that? 

    Can you please just answer the question below?

    What is the recommended way to tell if a user has typed into a RadTextBox BEFORE THE RADTEXTBOX HAS BEEN BLURRED?
  10. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 23 Nov 2012 Link to this post

    Hello Chris,

    You could override the get_value function to return the value when the input is blurred or to return the currently typed text if the input is in focus.

    <asp:ScriptManager runat="server">
    </asp:ScriptManager>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            if (Telerik.Web.UI.RadTextBox)
            {
                Telerik.Web.UI.RadTextBox.prototype.get_value = function ()
                {
                    if (this._focus)
                    {
                        return this._textBoxElement.value;
                    }
                    else
                    {
                        return this._value;
                    }
                }
            }
        </script>
    </telerik:RadScriptBlock>

    Then you will be able to use .get_value() to get the typed by the user text. or you can define your function similar way if you don't want to change the behaviour of the get_value one.

    Kind regards,
    Vasil
    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.
  11. Andrew
    Andrew avatar
    39 posts
    Member since:
    Feb 2011

    Posted 10 Dec 2012 Link to this post

    I agree with the original poster - after recently upgrading our project, this has presented us with a difficult problem on all our login forms.

    Bascially - we, as do most websites on the internet, intercept the enter key on either textbox on our login forms (username or password), and call the __doPostBack for the 'Log in' button manually. This provides a fluid interface for the users, and allows us to 'return false' to prevent the ding noise in IE when enter is uses on textboxes.

    Because of this breaking change, the __doPostback is fired, but no value is passed back for whichever textbox had the focus last! (and therefore didn't get blurred)

    Like the original poster, I have tried both calling .blur() for the textbox AND .focus() for the Log In button, prior to the __doPostBack, but neither works in IE9.

    Does the rad textbox have an internal method we can call to simulate it losing the focus and persisting the value to postback?
  12. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 10 Dec 2012 Link to this post

    Hello Andrew,

    The RadTextBox does not handle the formSubmit event, therefore it could not blur itself during the submit. You can use RadInputManager in combination with asp:TextBox as alternative.
    Also note that using __doPostBack on the login form breaks the username/password save capabilities of the browsers. They are saving form data only on form submit using a submit button. So if you need your users to be able to save their login information in the browsers it is best to use a button for handling the submit and RadInputManager with asp:TextBoxes for your login page.

    Regards,
    Vasil
    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.
  13. Andrew
    Andrew avatar
    39 posts
    Member since:
    Feb 2011

    Posted 10 Dec 2012 Link to this post

    In fact - we've found that we can wrap the RTBs and Submit button in an asp:panel and use the DefaultButton property to acheive the same thing. This also triggers the browser password saving mechanism correctly.
  14. Dicky
    Dicky avatar
    7 posts
    Member since:
    Mar 2010

    Posted 27 Feb 2013 Link to this post

    @Vasil, Hi.. I'm sorry but this really not makes sense for me, and I believe for the others. Why we need to do special action to only get the value of RadInput in server side? You cannot ask us to change all the control with asp:TextBox, since we bought this 3rd party control and we already used RadInput in many of applications, even in hundred forms. Replacing it with asp:TextBox will take a lot of effort.

    In fact this issue not exist on 2012.1.215  build version or lower. So it was okay, until you guys changed the behavior which mean this is regression, why makes people's life hard by changing the behavior?

  15. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 01 Mar 2013 Link to this post

    Hi Dicky,

    The RadDateInput always has worked this way, even before the 2012 Q1. We have unified the behaviour of all input controls, and currently they all have several stages client side, to be more customizable.
    Actually in sample page, you don't have to do nothing in order to make your TextBoxes to work properly. Because clicking on regular Button blurs the TextBox either way, causing it's value to be set properly.

    See, there was issues before, that we managed to fix, by changing the behaviour. An example of them is that before if the TextBox has AutoPostBack="true" pressing enter key, will cause 2 postbacks, one of them that to be aborted (one from the TextBox, and one from the DefaultButton). Actually you can check why we did this, since they are lots of additional benefits:
    http://blogs.telerik.com/blogs/posts/11-11-18/get-better-performing-input-fields-in-your-asp-net-ajax-apps.aspx
    http://blogs.telerik.com/blogs/posts/12-06-22/changes-in-radinput-in-q2-2012-version-of-radcontrols.aspx

    What makes different the RadInputControl from regular Asp:TextBox is that the RadInputControl has several different stages:

    Focused - the user edits value (the value is not considered as edited, until the user perform action like blur, or pressing enter). It is the same as if you are editing a filename in your windows explorer. If you are currently typing, and some another action disturbs your typing (like timer making autoPostBack), the edit will be canceled, not applied. It makes most sens for the users and gives them better control.

    Blurred - the user has finished with editing, now he could see his formatted value, or Empty or Error messages if they are such.

    Focused after pressing enter with no AutoPostBack - The value will be applied internally, and reformatted if required, but the focus is still inside the input.

    Pressing enter key with AutoPostBack - The value will be formatted and the control will initiate PostBack.

    This is making the RadTextBox hardly for using with timers, but not unusable, you could still force it to apply new value in the code of your timer using the set_value() and get_textBoxValue functions. For us it is bad idea to consider the value that your user is currently typing as "final", the users are making mistakes, and they should be able to edit the values before deciding that they should submit the form.

    Regards,
    Vasil
    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.
  16. Dicky
    Dicky avatar
    7 posts
    Member since:
    Mar 2010

    Posted 03 Mar 2013 Link to this post

    Hi Vasil,

    Thanks for your response. The Focused point (The value is not considered as edited, until the user perform action like blur, or pressing enter) which you mentioned seems worked in different way between build version 2012.1.215  (or lower) and the latest version. I didn't need to do blur to get the latest value that user just entered until I used the latest version.

    Try to download my simple sample page at here (http://spyro.uni.me/SamplePage.zip) and test with these steps:

    1. Enter text 'test' on the textbox
    2. Without change the focus, press ALT+T to trigger the button hot key
    3. It will say if the textbox cannot be empty even there is a text 'test'

    Another step to reproduce issue :
    1. Enter text 'test' on the textbox.
    2. Click the button Test (T) with mouse pointer.
    3. Note, you will get message if the textbox has content value: test.
    4. Change the text 'test' with 'new value'
    5. Without change the focus, press ALT+T to trigger the button hot key
    6. It will say if the textbox has content value: test. and the textbox value back to 'test'

    The fact is this issue not exist on Telerik.Web.UI build version 2012.1.215.35 and 2012.1.215.40

    Note: I have reported this issue at Support ID:651282. Please don't ask us to modify our codes to suitable with this changed since it will too heavy to do at our side.

    Best regards,

    Dicky



  17. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 04 Mar 2013 Link to this post

    Hi Dicky,

    We know it is different, and I explained why it is different.
    I would not go thought all the explanations again to explain why the new behaviour is more correct. There is alternative, presented in our suite and it is the RadInputManager. It is up to you to decide which control to use, and if you decide to upgrade from previous version, to check the release notes and rewrite your code according to the "breaking changes".

    Kind regards,
    Vasil
    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.
  18. Phil
    Phil avatar
    2 posts
    Member since:
    Mar 2009

    Posted 04 Mar 2013 Link to this post

    Hello Vasil,

    Rather than changing behavior like this, with no option but to use another control, would it not make sense to expose the behavior change via a property that we can use to get new or old behavior?

    At the end of the day, we don't care that it was inconsistent with the way other controls worked, or that it resolved some other issue(s), we just care that the long standing behavior that we relied on has changed and suddenly our applications no longer work.

    Sometimes updates are forced on us if we want support for new browsers etc. Using us upgrading as an excuse to make it our responsibility to have to rewrite our applications is a bit weak, and quite frankly, severely dents our confidence in Telerik.
  19. Dicky
    Dicky avatar
    7 posts
    Member since:
    Mar 2010

    Posted 07 Mar 2013 Link to this post

    I must say agree with Phil, at least there is some way that we can set to make the code we have working properly with minimum changes needed.
  20. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 12 Mar 2013 Link to this post

    Hello,

    We will try to provide easier access to the value even if the input is in focus, overriding the set_value as below works, but has some limitations:  the entered by the user text can't be the same as the empty message, since it would be treated as empty message.  I could not promise that it will be made, but we will try all possibilities for the service pack.

    Kind regards,
    Vasil
    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.
  21. Dicky
    Dicky avatar
    7 posts
    Member since:
    Mar 2010

    Posted 21 Oct 2013 Link to this post

    Hi Telerik team,

    What is the state of this issue? is the new property to fix this issue has been released?
    Also my supervisor wants to know why we are paying for Telerik for support and new releases if we are stuck on 2012.1.215.40?

    A better way, he feels, is if telerik provided a property so that those that want the new functions could use them by default but customers locked in by the cost of making the changes can continue with the old functionality. Since our systems are installed at government locations and they don't allow any changes without extensive testing by their test teams just think of the expense Telerik has caused by not continuing an existing feature.

    for your information, we have 1000 users trained at one site on what to expect and now we would have to retrain them. that is an extra cost too since manuals have to be changed, training plans changed, etc. While there is only 1000 use 7000 since that is what the license is for.
    every time we change something that affects the user has to upgrade all the help docs they have created, notify the users, support must be prepared for more questions, etc.

    Another thinking is with the latest version, user need to do blur by click other control, that will make every user need to spend a second to do that. Let say one user need to do that 50 times each day. then it will cost 50 (times clicks) x 1000 (users) = about 13 hours per day. That's about a man-year per year or about $150,000. As you can see this small bug may bring big lost for user!


    Best regards,

    Dicky

  22. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 22 Oct 2013 Link to this post

    Hi Dicky,

    This is already fixed, you can download the latest release and test it with your project. If you have any problems let us know.

    Regards,
    Vasil
    Telerik
    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 the blog feed now.
  23. GEORGE BRANDES
    GEORGE BRANDES avatar
    1 posts
    Member since:
    Mar 2010

    Posted 22 Oct 2013 Link to this post

    Hi Vassil,

    I downloaded and installed Telerik.Web.UI version and I keep getting this javascript error :

    Line: 673
    Error: '$telerik' is undefined

    Do you have any idea why?
    Thanks in advance.
  24. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 23 Oct 2013 Link to this post

    Hello,

    Probably you have scripts that use $telerik, above the declaration of your ScriptManager. They should be below the script manager.
    Also check this help topic:
    http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting.html

    Regards,
    Vasil
    Telerik
    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 the blog feed now.
  25. Dicky
    Dicky avatar
    7 posts
    Member since:
    Mar 2010

    Posted 23 Oct 2013 Link to this post

    Hi Vassil,

    No we don't have any code $Telerik on our project. There are 2 notes that you need to be aware of :

    1. We don't change any code, just did update from Telerik.Web.UI version 2012.1.215.40 to 2013.3.1015.40. The error occurs right after we did update
    2. This is only occurs on IE version < 10. It works on IE 10 without any error. Also it works on Chrome and Firefox. So there must be something wrong with Telerik code.

    FYI : We have script manager on MasterPage, and here is snippet of our web.config :
    <httpHandlers>
          <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
          <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler"verb="*" validate="false"/>
          <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*"validate="false"/>
          <add path="Telerik.RadUploadProgressHandler.ashx"type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
          <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*"validate="false"/>
        </httpHandlers>
        <httpModules>
          <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule"/>
          <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
        </httpModules>


    <handlers>
          <remove name="ChartImage_axd"/>
          <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler"verb="*" preCondition="integratedMode"/>
          <remove name="Telerik_Web_UI_SpellCheckHandler_axd"/>
          <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd"type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode"/>
          <remove name="Telerik_Web_UI_DialogHandler_aspx"/>
          <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx"type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode"/>
          <remove name="Telerik_RadUploadProgressHandler_ashx"/>
          <add name="Telerik_RadUploadProgressHandler_ashx"path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*"preCondition="integratedMode"/>
          <remove name="Telerik_Web_UI_WebResource_axd"/>
          <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd"type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/>
        </handlers>


    If we need to change our code when using latest version, please let us know where is the knowledge base or release note?

    A quick response will be appreciated since we must release our product ASAP.


    Best regards,

    Dicky
  26. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 23 Oct 2013 Link to this post

    Hi Dicky,

    I wrote you in the ticket you have send. It will be more easier for both of us to track the conversation in one place (and still you will get faster response in the ticket), so I am closing this thread now.

    Regards,
    Vasil
    Telerik
    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 the blog feed now.
  27. Tom
    Tom avatar
    4 posts
    Member since:
    Aug 2011

    Posted 01 May 2014 Link to this post

    In a previous response to Dicky, Vasil wrote: "This is already fixed".  Does anyone know what does 'this' is? Is anyone aware of any effort  Telerik has made to mitigate this terrible mistake on their part? We are struggling with this issue on the latest version of the controls.
  28. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 07 May 2014 Link to this post

    Hi Tom,

    The problem that "user need to do blur by click other control, before submit" was fixed.

    If you have any issue with the latest version, please share more details with us.

    Regards,
    Vasil
    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.

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