45.21 GET_ELEMENT_ATTRIBUTES Function

This function returns some of the standard attributes of an HTML element (such as ID, name, required, placeholder, aria-error-attributes, class) which generates an HTML tag (including input, select, or textarea) to get a consistent set of attributes.

Syntax

APEX_PLUGIN_UTIL.GET_ELEMENT_ATTRIBUTES (
    p_item                   IN apex_plugin.t_page_item,
    p_name                   IN VARCHAR2 DEFAULT NULL,
    p_default_class          IN VARCHAR2 DEFAULT NULL,
    p_add_id                 IN BOOLEAN  DEFAULT TRUE,
    p_add_labelledby         IN BOOLEAN  DEFAULT TRUE,
    p_aria_describedby_id    IN VARCHAR2 DEFAULT NULL,
    p_add_multi_value        IN BOOLEAN  DEFAULT FALSE ) 
RETURN VARCHAR2;

Parameters

Parameters Description
p_item The p_item parameter of your plug-in function.
p_name The value returned by apex_plugin.get_input_name_or_page_item.
p_default_class Default CSS class contained in the result string.
p_add_id If TRUE, then the ID attribute is also contained in the result string.
p_add_labelled_by

Returns some of the general attributes of an HTML element (for example, the ID, name, required, placeholder, aria-error-attributes, class) which should be used if an HTML input, select, or textarea tag is generated to get a consistent set of attributes.

Set to FALSE to render an HTML input element such as input, select, or textarea which does not require specifying the aria-labelledby attribute because the label's for attribute works for those HTML input elements.

Set it to TRUE for all non-standard form element widgets (such as those using div or span) which enable focus for screen reading software.

Note:

Inclusion of aria-labelledby requires the item plug-in to have Standard Form Element set to No and that the item's corresponding label template defines a #LABEL_ID# substitution.
p_aria_describedby_id Pass additional IDs here that you would like get_element_attributes to include in the value it renders for the 'aria-describedby' attribute on the form element. This is used to convey additional information to users of assistive technologies when they are focused on the form field.
p_add_multi_value If TRUE, renders the required attrbiutes for multiple values (multi-value, multi-value-storage, multi-value-separator). Used for items that support the mutiple value infrastructure.

Example

This example emits an INPUT tag of type text which uses apex_plugin_util.get_element_attributes to automatically include the most common attributes.

sys.htp.prn (
    '<input type="text" ' ||
    apex_plugin_util.get_element_attributes(p_item, l_name, 'text_field') ||
    'value="'||l_escaped_value||'" '||
    'size="'||p_item.element_width||'" '||
    'maxlength="'||p_item.element_max_length||'" '||
    ' />');