This is a migrated thread and some comments may be shown as answers.

Masked Input Get Value (javascript)

2 Answers 329 Views
Input
This is a migrated thread and some comments may be shown as answers.
NaturalCause
Top achievements
Rank 1
NaturalCause asked on 26 Mar 2010, 01:23 AM

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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Mar 2010, 07:32 AM

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.

0
NaturalCause
Top achievements
Rank 1
answered on 26 Mar 2010, 07:37 AM
Hey,

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

Using 'window' worked.

Thanks for your help.
Tags
Input
Asked by
NaturalCause
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
NaturalCause
Top achievements
Rank 1
Share this question
or