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

RadMaskedTextBox and Number/Phone Keyboard on Mobile device

1 Answer 108 Views
MaskedTextBox
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 25 Mar 2019, 11:55 PM
My requirement is to have a Masked textbox on a mobile form.  We need the numeric keyboard to appear when inputting values.  When using an asp:Texbox  can control the keyboard type by specifying TextMode="Phone".  Is there some equivalent property to the RadMaskedTextBox? I've tried using InputType="Number" but that doesn't seem to do the trick.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 28 Mar 2019, 01:06 PM
Hi Dave,

See how the RadMaskedTextBox is rendered:

<input id="ctl00_ContentPlaceholder1_RadMaskedTextBox3" name="ctl00$ContentPlaceholder1$RadMaskedTextBox3" type="text" size="20" class="riTextBox riEnabled" value="___ ____">

The problem here is that if we change the input type to "number"

<script>
    function OnClientLoad(sender, args) {
        sender.get_element().setAttribute("type", "number");
    }
</script>
<telerik:RadMaskedTextBox RenderMode="Lightweight" ID="RadMaskedTextBox3" runat="server" Mask="LLL ####" Width="222px">
    <ClientEvents OnLoad="OnClientLoad" />
</telerik:RadMaskedTextBox>

this will change the mobile keyboard to numeric, but this will also thrown a warning 

The specified value "___ ____" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?

and clear out the default mask set in the value so the input will be rendered empty.

I hope that you'll find this information useful.

Best regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MaskedTextBox
Asked by
Dave
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or