Applying a phone number format mask in oracle apex

2020-05-07 05:09发布

问题:

I have phone number field in database. I want to change my phone number format to "XXX-XXX-XXXX" as I type not after the result is submitted

回答1:

just keep in mind that, in the end, your APEX page is pretty much an HTML document. That said, you're able to tweak it using any JavaScript or CSS you want to.

For input masks, my "go-to" option is: https://github.com/RobinHerbots/Inputmask

I've tried a lot of JS library to mask inputs and that one was the best for my projects.

If you're unsure how to use it, here you go:

  1. Import the main dist file to your app. Use can upload it to the workspace, app, it doesn't matter as long you're able to reference it in your page.

  2. In your Pn_PHONE page item, go to Custom Attributes and enter your mask, for i.e., data-inputmask="'mask': '999-999-9999'"

  3. In Execute when Page Loads enter this code: $(':input').inputmask(); to apply mask to all inputs with data-inputmask.

  4. You're done.

Have a look at the JS library usage to check all settings you can use.



标签: oracle-apex