Single Article

Add item help to label using title attribute

Category APEX and jQuery

Here is how you can add item help using title attribute to APEX form items.

First create application process GET_ITEM_HELP:

DECLARE
  l_sql VARCHAR2(32700);
BEGIN

  l_sql := '
    SELECT item_name,
      item_help_text
    FROM apex_application_page_items
    WHERE application_id = :APP_ID
      AND page_id = :APP_PAGE_ID
      AND item_help_text IS NOT NULL;
  ';

  APEX_UTIL.JSON_FROM_SQL(l_sql);

END;

Add to page JavaScript Execute when Page Loads:

$.ajax({
 type:"POST",
 url:"wwv_flow.show",
 dataType:"json",
 data:{
  p_flow_id:"&APP_ID.",
  p_flow_step_id:"&APP_PAGE_ID.",
  p_instance:"&APP_SESSION.",
  p_request:"APPLICATION_PROCESS=GET_ITEM_HELP"
 },
 success:function(jd){
  $.each(jd.row,function(i,jr){
   $('label[for="' + jr.ITEM_NAME + '"] span.jelp').attr({"title":jr.ITEM_HELP_TEXT});
  });
 }
});

Copy your Optional label template to new name. Change Before Label definition:

<label for="#CURRENT_ITEM_NAME#" tabindex="999"><span class="optional jelp">

Edit label

Change your form items use new label template and write help to item Help section.

Run page and hover mouse over item label.

See working example.

 

Update 26.01.2012

On APEX 4.1 you do not need extra application process or JavaScript. You can just modify label template as below

<label for="#CURRENT_ITEM_NAME#" tabindex="999"><span class="optional" title="#CURRENT_ITEM_HELP_TEXT#">

Thanks to Peter informing that there is #CURRENT_ITEM_HELP_TEXT# substitution string available for label template.

Social Buttons

Comments

  • Jari Laine 25 Jan 2012  

    Hi Peter,

    Thank you for sharing this.

    Regards, Jari

        
  • Peter Raganitsch 25 Jan 2012  
    Hi, From APEX 4.1 onwards there the help text is available in the label template with the placeholder #CURRENT_ITEM_HELP_TEXT#. An Example can be found in the "Before Label" Item Help.     
  • Richard 25 Jan 2012  
    Thanks a lot for this example!     

Global Right Column

Search

Archives

Subscribe in a Reader