1. Upload the files to the Static Application or Workspace files
2. Load these files on application or page level (I will do it page level)
- Go to Shared Components/Plug-ins and click on create, and then create from scratch.
- Choose a name and internal name. The internal name is used internally by APEX for identifying the plug-in, it is not displayed.
- Choose the item type, it is where this plugin will be used.
Now, you must define a PL/SQL anonymous block that contains a function for rendering, validating, execution and Ajax callbacks for the plug-in. This can also be stored in the database.
/*When you create a item plugin, you must create the following interface. */
PROCEDURE render_mask_field (
p_item in apex_plugin.t_item,
p_plugin in apex_plugin.t_plugin,
p_param in apex_plugin.t_item_render_param,
p_result in out nocopy apex_plugin.t_item_render_result
/* Here we define a plugin attribute used by the developer to set the item mask */
lv_format_mask varchar2(100) := p_item.attribute_01;
/* We need to call the following function to allow APEX to map the submitted value to the actual page item in session state.
This function returns the mapping name for your page item. If the HTML input element has multiple values then set p_is_multi_value to TRUE.*/
lv_item_name varchar2(1000) := apex_plugin.get_input_name_for_page_item(false);
/* This outputs the necessary HTML code to render a text field*/
sys.htp.p('<input type="text" class="text_field apex-item-text '||p_item.element_css_classes||'" name="'||lv_item_name||'" placeholder="'||p_item.placeholder||'" id="'||p_item.name||'" value="'||sys.htf.escape_sc(p_param.value)||'"size="'||p_item.element_width||'"/>');
4. Now we set the name of render function
5. Supported for: We must define where the plugin is supported, where it is available in the Builder, Page Items and/or Interactive Grid Columns. Also if the plug-in is displayed in the Builder as a supported component for desktop and/or mobile.
6. Standard Attributes: For Item type plug-ins, identify the attributes that apply to this plug-in:
7. Now we must save, so APEX will identify the plugin type and add some plugin options, we must create the format mask custom attribute.
Finally, we can save and use the plugin. Just create a page item and change the item type to the plugin that we just created.
If you want to download this plugin, please go to: https://github.com/ExplorerUK/Explorer-Mask-Field