Inzajt Inzajt - 3 years ago 92
AngularJS Question

Input-field, force format 00:00.00

I have an input-field that has a value(model) with microseconds(ex. 1950), and a filter that transforms the microseconds to a human readable format, for example 00:19.50(this is displayed in the input-field). How can i validate or force the user to keep this format?

Answer Source

You can chive this by making use of the pattern attribute which accepts a regular expression.

You can read more about it here:

This is the example they provide.

<input type="url" name="website" required pattern="https?://.+">

I hope this helps.

@gapvision privided you an answer with a correct patter that suit your needs


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download