MaskedTextBox caret not properly set with fixed text

2 posts, 0 answers
  1. John
    John avatar
    22 posts
    Member since:
    Apr 2012

    Posted 03 Jun 2014 Link to this post

    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"
              });


  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 05 Jun 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top