get_value() not working anymore!!!

4 posts, 0 answers
  1. Tommy
    Tommy avatar
    30 posts
    Member since:
    Nov 2011

    Posted 17 Sep 2012 Link to this post

    I was running on a bit older version of telerik, but now I upgraded to the most resent version get_value() on radtextbox don't work anymore! 

    <telerik:RadTextBox ID="txtRecherche" runat="server" Width="335px" style="margin: 10px 0px;"
     <script type="text/javascript">
            function visibilite() {          
                var chaine = $find("<%= txtRecherche.ClientID %>").get_value();

    get_value always return an empty string except when make the focus on another control and then I return in this one. 
  2. Vasil
    Vasil avatar
    1540 posts

    Posted 18 Sep 2012 Link to this post

    Hi Tommy,

    On onkeyup event the value is still not updated, since it is not applied. The new value gets applied on blur/pressing enter or using set_value client side method.
    Before applying the new value, it is considered just as DisplayValue (which can be EmptyMessage/ ErrorMessage/ Formated Text. etc.)

    You can still access this text using get_textBoxValue() property during the keyup event. And you can force the control to consider this as actual value using textbox.set_value(textbox.get_textBoxValue());

    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. DevCraft R3 2016 release webinar banner
  4. Sophie
    Sophie avatar
    33 posts
    Member since:
    Aug 2012

    Posted 08 Mar 2013 Link to this post

    Thanks Vasil.
    I was having issues with this, i had to check for a textBox' s content.
    On my side i can't do
    because this will set the empty text value to the actual value. This will let my validation pass, which shouldnt.
    What i did is this:
    if($.trim(someTextBox.get_textBoxValue()) == '' || $.trim(someTextBox.get_textBoxValue()) == someTextBox.get_emptyMessage())
      alert('Has content.');
    And this works like a charm :)
  5. Allen
    Allen avatar
    50 posts
    Member since:
    Mar 2011

    Posted 11 Nov 2015 in reply to Sophie Link to this post




     So I can NOW avoid passing the EmptyMessage to a popup window...



      var oInput = document.getElementById('<%= tbNotes.ClientID %>');
                var oText = "";
                var emptyMessage = $find("<%= tbNotes.ClientID %>").get_emptyMessage();
                //'value' will send the EmptyMessage if nothing has been typed, which we do not want to see in the popup, so we null it out.
                if (oInput && (oInput.value !== emptyMessage)) {
                    oText = oInput.value;

Back to Top