How to load images and fragments dynamically in LiveCycle Designer forms?

北战南征 提交于 2019-12-06 15:10:24

问题


I've created a couple of shared templates (.xdp) which will be shared among several clients. Obviously, each client has their own logo and I'd like to set the logo upon form generation.

I've managed to change the logo dynamically although I'm not sure if my approach is good.

In the xml datasource I've got this element:

<ClientID>SomeNumber</ClientId>

In the form itself I set the image href with this javascript code:

SomeHiddenTextField::calculate
HeaderLogo.value.image.href = $record.ClientID + "_logo.jpg";

I've got the logos stored on the server in the same folder as the shared templates.

Is this an alright approach to load logos dynamically?

I've been trying to achieve the same dynamic behaviour with each client's footer fragment, but I have been unable to figure out how to load these on demand. I could make each footer fragment in to an image but I'd like to avoid it if possible.


回答1:


I know generally for loading images dynamically I had to do the following:

Create a SOAP service that returns a byte[] with the image data (base64)

Call the service from LiveCycle:

var cURL = "http://host/path/MyService?wsdl"
var oService = SOAP.connect(cURL);
try {
    var cText = "";
    var myRequest;
    var cSOAPAction;
myRequest = { 
 myMethod: { 
 Param1:value
 };
cSOAPAction= "http://mynamespace/myMethod";
}
    var myNamespace = "http://mynamespace";

    var oResults = SOAP.request ({
        cURL: cURL,
        oRequest: oGetNameByIdRequest,
        cAction: cSOAPAction,
        bEncoded: false,  // If false then document/literal encoding will be used.
        cNamespace: myNamespace,
        cResponseStyle: SOAPMessageStyle.Message
    }); 
    HeaderLogo.rawValue = oResults[0].soapValue[0].soapValue;
...


来源:https://stackoverflow.com/questions/2623018/how-to-load-images-and-fragments-dynamically-in-livecycle-designer-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!