开发者

Orbeon - Multi-language template HTTP Service request

开发者 https://www.devze.com 2023-04-03 23:05 出处:网络
On a multi-language template I use a HTTP service to load a list of countries from a web service. The loading itself is done by an action t开发者_运维百科hat reacts to the Form Load event.

On a multi-language template I use a HTTP service to load a list of countries from a web service. The loading itself is done by an action t开发者_运维百科hat reacts to the Form Load event.

Since the names of the countries are different in each language, I would like to pass a parameter to the web service that specifies the language of the user. Another option would be to select the correct label after the list has been loaded.

Unfortunately I don't have any clue on how to achieve this. Any ideas ?


I managed to pass the language to the web service by editing the source code manually. I added the language as web service request parameter with the following xml (added to the action).

<xforms:action context="instance('fr-service-request-instance')">
    <xforms:action class="fr-set-service-value-action">
        <xxforms:variable name="control-name" select="'requestor_country'" as="xs:string"/>
        <xxforms:variable name="path" select="//*:language" as="xs:string"/>
        <xforms:setvalue ref="$path" value="xxforms:instance('fr-language-instance')"/>
    </xforms:action>                
</xforms:action>

I still have one problem though, when the user switches language, the values are not loaded and the list is empty.

Currently the country list is loaded on the xforms-ready event. Which one should be used when switching language ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号