Hi there,
I'm looking for a way to clear a RadMaskedTextBox on the client side. Although the Clear() method is not listed in the documentation, it does work on the masked textbox. See below:
However, i'm looking for a way to pass in the element id "which" and clear only that text box:
I'm looking for a way to clear a RadMaskedTextBox on the client side. Although the Clear() method is not listed in the documentation, it does work on the masked textbox. See below:
| function RemovePhone(which) |
| { |
| var radInput = window["<%= phoneRadMaskedTextBox0.ClientID %>"]; |
| radInput.Clear(); |
| } |
However, i'm looking for a way to pass in the element id "which" and clear only that text box:
| function RemovePhone(which) |
| { |
| var radInput = document.getElementById("ctl00_ContentPlaceHolder2_phoneRadMaskedTextBox" + which); |
| radInput.Clear(); // doesn't work |
| radInput.text = ''; // doesn't work |
| radInput.value = ''; // doesn't work |
| } |
7 Answers, 1 is accepted
0
Hi Derek,
You need the masked text box client object in order to call its client-side functions. The client object can be obtained through the window["id"]. The second syntax will bring the DOM element to you, which is not supposed to have any client-side functions.
All the best,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You need the masked text box client object in order to call its client-side functions. The client object can be obtained through the window["id"]. The second syntax will bring the DOM element to you, which is not supposed to have any client-side functions.
All the best,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Derek
Top achievements
Rank 1
answered on 30 Apr 2008, 04:19 PM
Thanks for your response :)
0
Revital Keren
Top achievements
Rank 1
answered on 24 Sep 2008, 01:39 PM
Hi, I am having a similar problem - only I need to clear RadMaskedTextBox on the server side.
I have a range of numerics defined, so that my mask is a 7 digit text (each letter can be 0-9), so that when the control loads for the first time it looks like this 0000000 (kind of a default value).
is there a way for me to reset it beck to this default in a generic way ?
thanx,
Revital
I have a range of numerics defined, so that my mask is a 7 digit text (each letter can be 0-9), so that when the control loads for the first time it looks like this 0000000 (kind of a default value).
is there a way for me to reset it beck to this default in a generic way ?
thanx,
Revital
0
Hello Revital,
You can clear the MaskedTextBox value server-side by setting its Text to empty string (""). I have attached a sample which illustrates that.
All the best,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can clear the MaskedTextBox value server-side by setting its Text to empty string (""). I have attached a sample which illustrates that.
All the best,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Revital Keren
Top achievements
Rank 1
answered on 25 Sep 2008, 12:41 PM
Hi Konstantin ,
Thnak u for your reply, but I have already tried that and it doesn't work because , as I said before, I have the following mask defined : "<0..9><0..9><0..9><0..9><0..9><0..9><0..9>", which loads with the default Text of "0000000".
My question is if there's a way in which I can "clear" the Text value back to the default Text it loads with.
Thanks again,
Revital
Thnak u for your reply, but I have already tried that and it doesn't work because , as I said before, I have the following mask defined : "<0..9><0..9><0..9><0..9><0..9><0..9><0..9>", which loads with the default Text of "0000000".
My question is if there's a way in which I can "clear" the Text value back to the default Text it loads with.
Thanks again,
Revital
0
Hi Revital,
Is there a reason why you can't just set the text to the default value ("0000000") when you want to "clear" the current masked input value?
Let us know if I'm missing something out.
Regards,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Is there a reason why you can't just set the text to the default value ("0000000") when you want to "clear" the current masked input value?
Let us know if I'm missing something out.
Regards,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Revital Keren
Top achievements
Rank 1
answered on 28 Sep 2008, 07:17 AM
I wanted to use a generic way to clear all RadMaskedTextBox's to the initial Text value from design time.
In your solution I have to hard code the value for each instance of the control with no way of doing it generically...
In your solution I have to hard code the value for each instance of the control with no way of doing it generically...