Enable support of $v and $s for your APEX Item Plugins

Roel informed me that my HTML5 input type plugins don’t support the APEX Javascript API’s $v and $s (to retrieve and set the content of the item via Javascript).

After some quick investigations i detected that some Javascript was missing in my Plugin.

If an Item-Type Plugin is created and it is using something else than an <input> Tag with type=”text” you need to add a Javascript Callback function for getValue and setValue.

Example:

function info_oracleapex_html5_text_field(pSelector,pOptions)
{
  // Register apex.item callbacks
  apex.jQuery(pSelector).each(function(){

    apex.widget.initPageItem(this.id, {
      setValue      : function(pValue, pDisplayValue) {
        apex.jQuery('#' + this.id).val(pValue);
      },
      getValue      : function() {
        return apex.jQuery('#' + this.id).val();
      }
    });
  });
}

You can not only provide Callbacks for setValue and getValue, but also enable, disable, hide and show.

If you are looking for examples you can find some in the file apex_widget_4_1.js (which is provided with your APEX installation in the images/javascript folder).

I already fixed my HTML5 input type plugins and you can download the new version already.

One thought on “Enable support of $v and $s for your APEX Item Plugins

Leave a Reply

Your email address will not be published. Required fields are marked *