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

Cannot get value into RadMaskedTextBox

3 Answers 121 Views
Input
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 28 Sep 2010, 10:53 PM
I have a RadMaskedTextBox in my html, and cannot place a value in it from a javascript function call. If I change the type of textbox to just a regular asp.net TextBox, the value comes in just fine (33331).

How can I manipulate either the RadMaskedTextBox or js function to accept the value from the js? Below is my code.

<telerik:RadMaskedTextBox ID="priInsZip" runat="server" Height="21px" Mask="#####"
                                                                                                                            Width="70px">
                                                                                                                        </telerik:RadMaskedTextBox>


<js code>

var priInsZip = document.getElementById("priInsZip");

priInsZip.value = InsZip;


</js code>

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Sep 2010, 05:51 AM
Hi,

You need to use the $find() method to get the client side object of the RadMaskedTextBox.
 
        var dInput = $find("<%= priInsZip.ClientID %>");

Now use get_value() method of client object to get the value.


Have ea look at the following link to know more about client side methods of RadMaskedTextBox.
RadMaskedTextBox Client Object



-Shinu.
0
Bill
Top achievements
Rank 2
answered on 29 Sep 2010, 02:42 PM
Shinu, I tried your suggested solution, but all I got back after executing the $find method was an empty string. The var Zip just contained an empty string. Here is the js code below:

var Zip = $find("<%= priInsZip.ClientID %>");
                    var Zip2 = Zip.get_value();

priInsZip.value = Zip2.value;

I have the entire script block wrapped in a radcodeblock to take care of the server side tags within the js.

What am I doing incorrectly?

0
Cori
Top achievements
Rank 2
answered on 29 Sep 2010, 03:10 PM
Hello WIlliam,

The line where you're setting the value should look like this:

Zip.set_value(Zip2);

I hope that helps.
Tags
Input
Asked by
Bill
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Bill
Top achievements
Rank 2
Cori
Top achievements
Rank 2
Share this question
or