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

MaskedTextBox caret not properly set with fixed text

1 Answer 232 Views
MaskedTextBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 2
John asked on 03 Jun 2014, 07:05 PM
I have a MaskedTextBox with a prefix. I want the caret to be placed on the part after the prefix. 

E.g. OH00________
                 ^
                 \ -- Caret Here

But the caret actually appears here:

E.g. OH00________
          ^
           \ -- Caret Here

How can I make the MaskedTextBox behave this way?

<li><label>State ID: <input class="k-textbox"  name="state-id" maxlength="50" type="text" data-bind="value: stateId" pattern="OH00[0-9]{8}" validationMessage="Please enter a state ID in the form of OH0012345678"/></label>  <span class="k-invalid-msg" data-for="state-id"></span></li>
$("input[name='state-id']").kendoMaskedTextBox({
              mask: "OH0099999999"
          });


1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 05 Jun 2014, 02:20 PM
Hello John,

I am afraid that the Masked input does not provide such cursor positioning API which you can use. The only way would be to try and to apply work-around such as this one:

http://stackoverflow.com/questions/511088/use-javascript-to-place-cursor-at-end-of-text-in-text-input-element

Here is a small example:

http://trykendoui.telerik.com/@pesho/awUc

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MaskedTextBox
Asked by
John
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or