表单提交后的确认对话框(警报)
我想知道是否有任何方法可以在 adobe reader 中通知用户 pdf 表单已提交到服务器? 我正在提交一个 正常的 http/html 形式到 php 脚本没什么大不了的,直接, 但文档、论坛等似乎存在一个很大的“黑洞”。 提交表格后会发生什么。
有没有办法在我提交后触发 javascript 警报 表单?? 我不想返回另一个说“谢谢”的 pdf, 这有点俗气。 我对 pdf 表格很陌生,所以我猜有 必须是一种将 FDF 返回到具有某些内容的原始文档的方法 其中执行的 javascript 例如alert('谢谢你的 反馈!')..
这应该是很简单的,我认为 Adobe 被大肆宣传 PDF 技术对开发人员更加友好且易于访问。
有什么想法吗? (哦,请不要问为什么我使用 pdf 表单而不是网络,这是来自“The Top”,所以作为一名开发人员我只需要这样做......)
I was wondering if there is any way to notify a user in adobe reader
that a pdf form has been submitted to the server? I am submitting a
normal http/html form to a php script no big deal, straight forward,
but there seems to be a big "black hole" in documentation, forums etc.
as to what happens when the form is submitted.
Isn't there a way to trigger a javascript alert after I have submitted
a form?? I dont't want to return another pdf that says "thank you",
that is a bit tacky. I am very new to pdf forms so I am guessing there
must be a way to return FDF to the original document that has some
javascript in it that is executed eg alert('thank you for your
feedback!')..
This should really be straight forward, I assumed Adobes much hyped
PDF technology was much more developer freindly and accessible..
Any ideas?? (Oh and please don't ask why I am using pdf forms and not the web, this is coming from "The Top", so as a developer I just have to do it..)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您要发布到的服务器脚本必须在 HTTP 标头中回复此内容类型:
“Content-Type: application/vnd.fdf”,
例如。 如果您使用 PHP:
后面跟着相关的 bastardized-pdf-javascript-mutant-half-bread ,它将触发alert()对话框。
我希望您收到此消息,因为我浪费了近两周的时间来寻找解决方案......
The server script which you are posting to must reply with this content type in the HTTP header:
'Content-Type: application/vnd.fdf'
eg. If you are using PHP:
followed by the relevant bastardized-pdf-javascript-mutant-half-bread that will trigger the alert() dialog.
I hope you receive this message, as I wasted nearly 2 weeks of my life finding a solution...
谢谢你! 我也一直在寻找解决方案几个小时! 这是非常令人沮丧的。 仅仅为了在提交 PDF 后得到一个简单的确认对话框而安装 FDF Toolkit 似乎有些过分了。
我最终通过反复试验得出以下结论(似乎网上绝对没有关于此的文档):
上面将在 Adobe Reader 中呈现(或应该呈现)一个对话框,而不显示“警告:JavaScript 窗口”警告。
希望这最终对某人有用。
Thanks for this! I too have been searching for a solution to this for hours! It was extremely frustrating. It seems like overkill to install the FDF Toolkit just to get a simple confirmation dialog box after the PDF has been submitted.
I eventually came up with the following through trial and error (it seems there is absolutely no documentation about this on the net):
The above will present (or should present) a dialog box in Adobe Reader without showing the "Warning: JavaScript Window" warning.
Hope this ends up being useful to someone.
我为此争论了好几天,试图找出为什么当我使用 response.write 发送 FDF 时,它不会显示在 Reader 中。 我尝试发送手工制作的 FDF 并安装 FDF 工具包来创建 FDF 响应。 我能够创建有效的 FDF,因为我能够在 Reader 中本地打开并正确显示弹出窗口,但我无法让它在我从 ASP.NET 页面发送 FDF 的整个生命周期中工作。
然后灵感来了。 在我发送 FDF 的一次尝试中,我将 FDF 存储在一个文件中,并尝试使用流读取器将其注入响应中。 在多次尝试使用response.write失败后,我突发奇想尝试使用response.redirect到保存的fdf文件,结果成功了。 我之前已将 fdf 添加为我的网站的注册 MIME 扩展,并使用 application/vnd.fdf 作为 MIME 类型。 现在用户提交成功后会收到弹出窗口。 C# 中的简单解决方案如下所示:
I wrangled with this for days, trying to figure out why when I sent the FDF using response.write, it just wouldn't display in Reader. I tried sending both hand-crafted FDF and installing the FDF toolkit to create the FDF response. I was able to create valid FDF, as I was able to open locally in Reader and have the pop-up display correctly but I couldn't get it to work for the life of me sending FDF from my ASP.NET page.
Then inspiration struck. In one of my attempts to send the FDF, I stored the FDF in a file and tried to use a streamreader to pump it into the response. After many unsuccessful attempts to use response.write, on a whim I tried response.redirect to the saved fdf file and it worked. I had previously added fdf as a registered MIME extension for my web site, with application/vnd.fdf as the MIME type. Now the user receives the pop-up after successful submission. The simple solution, in C#, looks like this:
经过三天的搜索,我设法找到了答案,在 php 脚本中添加 fdf 文件的标头,在 acrobat 中的 url 末尾添加“#FDF”似乎是解决方案;
%FDF-1.2
1 0 对象
<<
/FDF
<<
/JavaScript
<<
/文档 2 0 R
/之后(确认发送();)
I managed to happen upon the answer after 3 days of searching, adding a header for fdf file in the php script, adding '#FDF' to the end of the url in acrobat seems to have been the solution;
%FDF-1.2
1 0 obj
<<
/FDF
<<
/JavaScript
<<
/Doc 2 0 R
/After (confirmSend();)