Announcement

Collapse
No announcement yet.

Create input mask on input text field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Create input mask on input text field

    i would like to create an input mask on a standard input text field that following the below regex

    "[0-9A-F]{2}\.[0-9A-F]{2}\.[0-9A-F]{2}$"
    basically, 2 hex digits DOT 2 hex digits DOT 2 hex digits

    is there anything in the jui or jquery libraries we already have loaded that would help?
    Mark

    HS3 Pro 4.2.19.5
    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
    Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

    #2
    Use of bootstrap validate, not sure it was package as part of bootstrap.
    See here https://bootstrap-validate.js.org/v2/rules.html
    and look for: bootstrapValidate('#input', 'regex:^[a-z]+$:Please fulfill my regex')

    Comment


      #3
      i found/figured out what i needed using a jquery.inputmask library

      Code:
       <script type="text/javascript" src="/insteon/inputmask/jquery.inputmask.js"></script>
      <script type="text/javascript" src="/insteon/inputmask/bindings/inputmask.binding.js"></script>
      then added my mask to the input tag as follows:

      Code:
      <input type="text" id="insteonid" class="form-control jui-input" value="" data-inputmask="'mask': '##.##.##'"/>
      here's the library
      https://github.com/RobinHerbots/Inputmask
      Mark

      HS3 Pro 4.2.19.5
      Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
      Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
      Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

      Comment

      Working...
      X