getNetuiTagName

来源:互联网 发布:avmoo 域名 编辑:程序博客网 时间:2024/05/19 23:02
 

<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>.

当你需要传递tagId值给一个HTML标签(或者其他没在<netui...>标签库里的标签)的时候,这个标签尤其有用。

    <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

idThe id attribute is deprecated, use the tagId attribute instead. The id attribute of the rendered HTML tag.
 
RequiredSupports runtime expression evaluationData bindable
NoNo

tagId

这个ID属性不被推荐,用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 ).

注意,传给浏览器的真正的id属性可能被程序容器改变(例如,Portal容器可能改变传递的id值以保证id在页面中的唯一性)。真正的id可以通过javascript函数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 )
这个函数将查找传给浏览器的真正的id属性。

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>元素和所有的孩子元素。

    <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 )]
这个函数将得到<netui:form> 元素和它所有的孩子元素(被包装成一个数组)。

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.

 
RequiredSupports runtime expression evaluationData bindable
YesYesNo

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>
原创粉丝点击