Masked Input Get Value (javascript)

3 posts, 0 answers
  1. NaturalCause
    NaturalCause avatar
    8 posts
    Member since:
    Mar 2010

    Posted 25 Mar 2010 Link to this post

    Hey,

    I'm trying to get the value of a masked input field via javascript.

    I'm using version 2.1.5.0 of the RadInput.Net2

    On the founds I found:

    http://www.telerik.com/community/forums/aspnet/input/radmaskedtextbox-javascript-value.aspx
    http://www.telerik.com/community/forums/aspnet/input/input-into-radmaskedtextbox-with-qtp.aspx

    However It's not working.

    I've tried:

    alert(document.getElementById('_ctl0_ph_txtSocialSecurityNumber').GetValue());

    alert($find('_ctl0_ph_txtSocialSecurityNumber').GetValue());

    alert(_ctl0_ph_txtSocialSecurityNumber.GetValue();

    And a few other variations. Nothing works. I can get the value with jQuery and other methods but i need the unmasked version. The same functionality as the new version:

    http://www.telerik.com/help/aspnet-ajax/input_clientsideradmaskedtextbox.html

    get_value - Returns the value of the text box. This is the string without any prompt characters or literals.

    Any ideas?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Mar 2010 Link to this post

    Hello Phillip Haydon,

    Give a try with the following client code in order to get the typed value from RadMaskedTextBox.

    ClientSide code:

     
    <script type="text/javascript">  
    function getV()  
    {  
        var maskInput = window["<%= RadMaskedTextBox1.ClientID %>"];  
        var text = maskInput.GetValue();     
        alert(text);  
    }  
    </script> 

    Also check out the documentation which lists most important client methods of input controls.

    Client-Side Object Model

    -Shinu.

  3. NaturalCause
    NaturalCause avatar
    8 posts
    Member since:
    Mar 2010

    Posted 26 Mar 2010 Link to this post

    Hey,

    Thanks for pointing me to the documentation, i couldn't find it before. *book marks it*

    Using 'window' worked.

    Thanks for your help.
Back to Top