0

カスタム コントロールのラベルに「for」属性がありません。lhha モードを使用していましたが、問題を修正するために custom-lhha モードに切り替えました。

以下のコードは非常に奇妙なことをしています。label 要素には、正しいラベル コンテンツを持つ 2 つのネストされたスパンが含まれており、for 属性には正しい ID の部分が含まれています。

<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
     xmlns:xf="http://www.w3.org/2002/xforms"
     xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
     xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
     xmlns:xbl="http://www.w3.org/ns/xbl"
     xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">

<xbl:binding element="fr|image-picker" id="fr-image-picker" xxbl:mode="lhha custom-lhha binding value" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
    <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
        <display-name lang="en">Image Picker</display-name>
        <icon lang="en">
            <small-icon>/apps/fr/assets/img/camera.png</small-icon>
            <large-icon>/apps/fr/assets/img/camera.png</large-icon>
        </icon>
        <templates>
            <view>
                <fr:image-picker id="image-picker" ref="">
                    <xf:label ref=""/>
                    <xf:hint ref=""/>
                    <xf:help ref=""/>
                    <xf:alert ref=""/>
                </fr:image-picker>
            </view>
        </templates>
    </metadata>
    <xbl:template>
        <xh:label for=""><xf:output value="xxf:label('fr-image-picker')"/></xh:label>
        <xf:input ref="xxf:binding('fr-image-picker')" class="image-picker"/>
    </xbl:template>
</xbl:binding>

ヒントをいただければ幸いです。

4

1 に答える 1

0

以下は、バインディングとラベルのサポートを備えた単純なコンポーネントを定義する例です。コンポーネントを使用するときは、単純に通常のxf:label:

<xh:html
        xmlns:xh="http://www.w3.org/1999/xhtml"
        xmlns:xf="http://www.w3.org/2002/xforms"
        xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
        xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
    <xh:head>
        <xf:model>
            <xf:instance>
                <form xmlns=""/>
            </xf:instance>
        </xf:model>
        <xbl:xbl xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
            <xbl:binding element="fr|image-picker" id="fr-image-picker" xxbl:mode="lhha binding value" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
                <xbl:template>
                    <xf:input ref="xxf:binding('fr-image-picker')"/>
                </xbl:template>
            </xbl:binding>
        </xbl:xbl>
    </xh:head>
    <xh:body>
        <fr:image-picker ref=".">
            <xf:label>My Label</xf:label>
        </fr:image-picker>
    </xh:body>
</xh:html>

で外部ラベルを使用したい場合はfor、単純に に id を与えて、通常どおりfr:image-picke使用します。for

<xf:label for="my-date-picker">My Label</xf:label>
<fr:image-picker id="my-date-picker" ref="."/>
于 2013-08-22T01:02:57.523 に答える