Livecycle 形式的动态超链接
我试图弄清楚如何在 Livecycle 表单中创建一个超链接,该链接指向一个 URL,该 URL 将在表单呈现的不同日期发生变化。 例如,有一天我可能希望超链接指向:
mywebsite/mypage?option=XXX
,另一天我希望它指向:
mywebsite/mypage?option=YYY< /strong>
XXX 和 YYY 可以很容易地以 XML 形式传递到表单的数据中,但我只是不知道如何制作它以便更改超链接以与此相对应。
有什么建议么?
I am trying to figure out how to make a hyperlink in a Livecycle Form which points to a URL which will change on different days that the form is rendered. For example on one day I might want the hyperlink to point to:
mywebsite/mypage?option=XXX
and on another day I want it to point to:
mywebsite/mypage?option=YYY
The XXX and YYY can be passed into the form's data pretty easily as XML, but I just don't know how to make it so that the hyperlink is changed to correspond to this.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可以通过 LiveCycle Designer 中的 JavaScript 来完成。 放置在表单的 docReady 事件上的以下脚本将允许您动态更改文本对象的 URL。
有一些注意事项: Acrobat 中的 URL 仅在 Acrobat 9.0 及更高版本中受支持。 因此,如果有人使用旧版本的 Acrobat 打开您的表单,则 URL 将不起作用。
另外,正如您从“if (xfa.host.name !=...)”行中看到的那样,如果在服务器上生成表单,则此代码将无法正常运行,因为会强制重新布局docReady 期间的表单可能会导致某些旧版本的 LiveCycle 服务器出现问题。 如果您确实需要在服务器上运行此脚本,您可能应该选择一个不同的事件,然后选择 form::docReady。
This can be accomplished with JavaScript in LiveCycle Designer. The following script, placed on the Form's docReady event will let you dynamically change the URL of a text object.
There are a couple of caveats: URLs in Acrobat are only supported in Acrobat 9.0 and later. So if someone using an older version of Acrobat opens your form, the URLs won't work.
Also, as you can see from the "if (xfa.host.name !=...)" line, this code won't run properly if the form is being generated on the server, because forcing a re-layout of a form during docReady can cause problems on certain older versions of the LiveCycle server. If you do need to run this script on the server, you should probably pick a different event then form::docReady.
WorkSpace 中的许多用户抱怨单击链接会在同一选项卡中打开它们,因此他们丢失了 WorkSpace 表单,并且在 Designer 11 中没有选项可以更改这一点。我认为我提出的解决方案适合您也。
我制作了没有边框和背景的按钮,并在其点击事件中包含此行(在 Javascript 中,在客户端运行)
app.launchURL("http:/stackoverflow.com/", true);
添加一些逻辑来根据日期选择正确的 URL 很容易,并且不会导致任何表单重新呈现。
在某些超链接与其他文本对齐的地方,我将链接文本保留为蓝色并加下划线,但没有超链接,只需将按钮(无背景、无边框、无标题)放在其上方。 确实需要定位且不流动的子表单才能工作,因此根据您的布局,它可能会变得有点笨拙。
哇,刚刚意识到我参加聚会太晚了。 好吧,对于任何使用 ES4 并面临类似问题的人来说。 。 。
I a number of complaints from users in WorkSpace that clicking links opened them in the same tab so they lost their WorkSpace form, and there's no option to change that in Designer 11. I think the solution I came up with for that would work for you too.
I made buttons with no border and no background, and in their click event have this line (in Javascript, run at client)
app.launchURL("http:/stackoverflow.com/", true);
It would be easy to add some logic to choose the right URL based on the day and it doesn't cause any form re-rendering.
In some spots where the hyperlink is in line with other text, I leave the text of the link blue and underlined but with no hyperlink, and just place the button (no background, no border, no caption) over it. Does require positioned and not flowed subforms for that to work, so depending on your layout it could get a little clunky.
Wow, just realized I am super late to the party. Well, for anyone using ES4 facing a similar problem . . .
最终使用第 3 方组件来操作 PDF 的超链接...希望有一个更好的解决方案,因为这个解决方案的成本约为 1000 美元。
Ended up using a 3rd party component to manipulate the PDF's hyperlinks...wish there was a better solution as this one costs about $1000.