Pakistani CNIC and mobile format Masking Required

13,590

Solution 1

Please try this code,

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery.inputmask.bundle.js"></script>


    <input type="text"  data-inputmask="'mask': '99999-9999999-9'"  placeholder="XXXXX-XXXXXXX-X"  name="cnic" required="" >

    <input type="text"  data-inputmask="'mask': '0399-99999999'" required=""  type = "number" maxlength = "12" >

   <script>
    $(":input").inputmask();

   </script>

Solution 2

numeric keyboard instead of alphabetical:-

this.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

in the file MaskedEditText.java. Now setting android:inputType = "numeric" will work.

Thanks

Share:
13,590

Related videos on Youtube

Sarfaraz
Author by

Sarfaraz

Updated on June 06, 2022

Comments

  • Sarfaraz
    Sarfaraz over 1 year

    I have work on a project to used the mask of cnic and mobile for Pakistani format.

    The format of CNIC is : XXXXX-XXXXXXX-X

    The format of Mobile is 03XX-XXXXXXX

    CODE:

       $('#CNIC_No').mask("99999-9999999-9");
    
    • blueren
      blueren almost 6 years
      Need to understand what #CNIC_No contains, and what mask actually does. Can you be more detailed with your question and provide more explanation?
  • evolutionxbox
    evolutionxbox almost 6 years
    What does changing a java file have to do with it?

Related