# <netui:getNetuiTagName> Tag

Returns the value of the tagId attribute.

## Syntax

<netui:getNetuiTagName
[id="id"]
tagId="string_tagId" />

## Description

Returns the value of the tagId attribute. This tag allows you to track the value of the tagId attribute, the value of which will be re-written if the web application is part of a Portal application. This tag is especially useful when you need to pass the tagId value to an HTML tag, or to some other tag that is not within the <netui...> tag library. In the following example, the tagId value is passed from the tag <netui:radioButtonOption> to the HTML tag <label>.

        <netui:radioButtonOption tagId="radio1" value="value1"/>
        <label for="<netui:getNetuiTagName tagId="radio1"/>">Display Text 1</label>

If the tagId attribute in the tag is re-written, the <label> can access the re-written value through the tag <netui:getNetuiTagName>.

## Attributes

id | The id attribute is deprecated, use the tagId attribute instead. The id attribute of the rendered HTML tag.
Required | Supports runtime expression evaluation | Data bindable
No | No |
tagId | String value. Sets the `id` (or `name`) attribute of the rendered HTML tag. Note that the real id attribute rendered in the browser may be changed by the application container (for example, Portal containers may change the rendered id value to ensure the uniqueness of id's on the page). In this case, the real id rendered in the browser may be looked up through the JavaScript function getNetuiTagName( tagId, tag ). For example, assume that some tag's `tagId` attribute is set to `foo`.
        <netui:textBox tagId="foo" />
Then the following JavaScript function will return the real id attribute rendered in the browser:
        getNetuiTagName( "foo", this )
To get a <netui:form> element and all of its children elements in JavaScript, use the same JavaScript function `getNetuiTagName( tagId, tag )`. For example, assume that there is a <netui:form> whose tagId attribute is set to `bar`.
        <netui:form tagId="bar" >
Then the following JavaScript function will return the <netui:form> element and its children (packaged as an array).
        document[getNetuiTagName( "bar", this )]
To retreive the value entered into a <netui:textBox> within the <netui:form> tag, use the following JavaScript expression.
        document[getNetuiTagName("bar", this)][getNetuiTagName("foo", this)].value
The second parameter ensures that the JavaScript function begins its search within the correct Portlet scope. Pass the JavaScript keyword `this` as the second parameter. For detailed information on using the function `getNetuiTagName( tagId, tag )` see Using JavaScript in Page Flow and Portal Applications.
Required | Supports runtime expression evaluation | Data bindable
Yes | Yes | No

## Sample

        <netui:form action="processData">
            <netui:radioButtonGroup dataSource="{actionForm.selection}">
                <label for="<netui:getNetuiTagName tagId="radio1"/>">Display Text 1</label><netui:radioButtonOption tagId="radio1" value="value1"/><br>
                <label for="<netui:getNetuiTagName tagId="radio2"/>">Display Text 2</label><netui:radioButtonOption tagId="radio2" value="value2"/><br>
                <label for="<netui:getNetuiTagName tagId="radio3"/>">Display Text 3</label><netui:radioButtonOption tagId="radio3" value="value3"/><br>
            </netui:radioButtonGroup>
            <netui:button value="Submit" />
        </netui:form>

## Related Topics

Using JavaScript in Page Flow and Portal Applications