これは、LiveCycle DesignerのJavaScriptを使用して実行できます。フォームのdocReadyイベントに配置された次のスクリプトは、テキストオブジェクトのURLを動的に変更できるようにします。
form1::docReady - (JavaScript, client)
// If this code is running on the server, you don't want it to run any code
// that might force a relayout, or you could get stuck in an infinite loop
if (xfa.host.name != "XFAPresentationAgent") {
// You would load the URL that you want into this variable, based on
// whatever XML data is being passed into your form
var sURL = "www.stackoverflow.com"; // mywebsite/mypage?option=xxx
// URLs are encoded in XHTML. In order to change the URL, you need
// to create the right XHTML string and push it into the Text object's
// <value> node. This is a super simple XHTML shell for this purpose.
// You could add all sorts of markup to make your hyperlink look pretty
var sRichText = "<body><p><a href=\"" + sURL + "\">Foo</a></p></body>";
// Assuming you have a text object called "Text1" on the form, this
// call will push the rich text into the node. Note that this call
// will force a re-layout of the form
this.resolveNode("Text1").value.exData.loadXML(sRichText, false, true);
}
注意点がいくつかあります:AcrobatのURLはAcrobatのみ9.0以降でサポートされています。したがって、古いバージョンのAcrobatを使用しているユーザーがフォームを開くと、URLは機能しません。
また、 "if(xfa.host.name!= ...)"の行からわかるように、サーバー上でフォームが生成されている場合、このコードは正しく実行されません。 docReady中にフォームがレイアウトされていると、特定の古いバージョンのLiveCycleサーバーで問題が発生する可能性があります。このスクリプトをサーバー上で実行する必要がある場合は、おそらく別のイベントを選択してから、docReadyを作成する必要があります。