Topic: Customize an input mask behaviour

Břetislav Válek priority asked 9 months ago

Dear support,

please advise me with customizing a behaviour of an input mask.

We use input mask for inputs fields where we need users to type several numbers right after "27ZG" code. Up to this point, everything is fine.

Now we need customize two more things in the input field as follows:

1st: Display a cursor right after "27ZG" code.2nd: Prevent deleting already written values by clicking out of the input. (When input is not in focus).

For better uderstanding, I have prepared a snippet here:

Thank you for any support provided.Bretislav

Michał Duszak staff answered 9 months ago

Hello. I prepared some custom code for first issue - "27ZG" will be inserted at the beginning each time, and if user will decide to delete that - input value will be cleared with "27ZG" at the beginning. Second issue could be resolved by adding data-mdb-clear-incomplete="false" attribute into your input mask.

Here is the snippet:

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • User: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.2
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes