v 10.0 v 11.0 v 12.0 Third Party 1738
Download for v 10.0 Deploy on Odoo.sh
Lines of code 167
Technical Name inputmask_widget
LicenseAGPL-3
Websitehttps://gilvanleal.github.io/odoowidgets/
Also available in version v 11.0 v 12.0
You bought this module and need support? Click here!
Lines of code 167
Technical Name inputmask_widget
LicenseAGPL-3
Websitehttps://gilvanleal.github.io/odoowidgets/
Also available in version v 11.0 v 12.0

Inputmask Widget

Based on jquery.inputmask 3.x Docs in GitHub.

An Inputmask Widget helps the user with the input by ensuring a predefined format.
This can be useful for dates, numerics, phone numbers, ...

Instructions:

  • Just add attribute widget="mask" and data-inputmask[-<attribute>]="<value>" to <field /> on form, tree and kanban

    Some examples:

    <field widget="mask" data-inputmask="'alias': 'date'" name="name" />
    <field widget="mask" data-inputmask="'mask': '99/99/9999'" name="name" />
    <field widget="mask" data-inputmask="'mask': '99-aa-**-AA-&amp;&amp;-##'" name="name" />
    <field widget="mask" data-inputmask="'mask': '9', 'repeat': 10, 'greedy' : false" name="name" />
    

    Or:

    <field widget="mask" data-inputmask-alias="date" name="name" />
    <field widget="mask" data-inputmask-mask="99/99/9999" name="name" />
    <field widget="mask" data-inputmask-mask="99-aa-**-AA-&amp;&amp;-##" name="name" />
    <field widget="mask" data-inputmask-mask="9" data-inputmask-repeat="10" data-inputmask-greedy="false" name="name" />
    

    Note: Use contenteditable="true" for apply mask in others HTML tags: span, div, etc. Improve

  • Just add attribute widget="mask_regex" and data-inputmask[-regex]="<value>" to <field />

    With the regex extension you can use any regular expression as a mask. Currently this does only input restriction. There is no further masking visualization.

    Example email validation:

    <field widget="regex_mask" data-inputmask-regex="[a-zA-Z0-9._%-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}" name="name"/>
    
  • Widgets names use:

    mask:Char Field
    integer_mask:Integer Field
    float_mask:Float Field
    regex_mask:Char Field
    monetary_mask:in development...
  • Masking definition:

    9:Numeric value
    a:Alphabetical value
    *:Alphanumeric value
    A:Alphabetical uppercasing
    &:Alfanumeric uppercasing - (Use &amp; for escape & in XML file)
    #:Hexadecimal
  • Attributes:

    mask:The mask to use.
    repeat:Mask repeat function. Repeat the mask definition x-times.
    greedy:Toggle to allocate as much possible or the opposite. Non-greedy repeat function.
    placeholder:Change the mask placeholder. Default: "_"
    autounmask:Automatically unmask the value when retrieved. Default: false.
    removemaskonsubmit:
     *Remove the mask before submitting the form.Default: false
    clearmaskonlostfocus:
     Remove the empty mask on blur or when not empty removes the optional trailing part Default: true
    insertmode:Toggle to insert or overwrite input. Default: true.
    clearincomplete:
     Clear the incomplete input on blur.
    alias:The alias to use.
  • Aliases:

    Some aliases found in the extensions are: email, currency, decimal, integer, date, datetime, dd/mm/yyyy, url, ip, etc.

    Docs:

    • Date and Datetime
    • Numeric
    • Regex
    • Phone
    • Other

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
groupSeparator not work in read mode
by
ainur rofiq
on 3/30/17, 2:46 AM

all things are good. But when I try alias:decimal with groupSeparator, the sparator is working when edit the field. but, when form is saved groupSeparator is disappear thanks


by
Gilvan Leal
on 3/20/17, 11:01 AM

Answer for Ainur Rofiq
by
Gilvan Leal
on 5/5/18, 11:49 AM Author

try this : widget="mask" data-inputmask="'alias':'decimal', 'groupSeparator':',', 'autoGroup':true"


Great Module - Need Odoo 11 version
by
G Jennings
on 10/23/17, 8:57 AM

We greatly appreciate the work with this module. When do you expect to upgrade to module to v11?


How to format float field with thousand separator
by
Nguyen Minh
on 6/24/17, 11:55 PM

This is great widget, I am trying to format a float field in xml view with thousand seperator when I input data in edit mode: 120000000 --> 120.000.000 I tried with alias like this in xml: "" But it doesn't work. I also want the mask also need to be remove when I call any function via button action in the form. Could anyone help me correct the code. Thank you a lot in advance.


How to format float field with thousand separator
by
Nguyen Minh
on 6/24/17, 11:52 PM

This is great widget, I am trying to format a float field in xml view with thousand seperator when I input data in edit mode: 120000000 --> 120.000.000 I tried with alias like this in xml: But it doesn't work. I also want the mask also need to be remove when I call any function via button action in the form. Could anyone help me correct the code. Thank you a lot in advance.


groupSeparator not work in read mode
by
ainur rofiq
on 3/30/17, 2:46 AM

all things are good. But when I try alias:decimal with groupSeparator, the sparator is working when edit the field. but, when form is saved groupSeparator is disappear thanks


groupSeparator not work in read mode
by
ainur rofiq
on 3/30/17, 2:45 AM

all things are good. But when I try alias:decimal with groupSeparator, the sparator is working when edit the field. but, when form is saved groupSeparator is disappear thanks