이 작업은 LiveCycle Designer의 JavaScript로 수행 할 수 있습니다. Form의 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.