xfa.host.messageBox(xfa.layout.page(this)); not working (JavaScript)

dpz_

04-03-2016

Hi,

i am setting this.rawValue = xfa.layout.page(this); in layout:ready Event. This is working fine.

But when i am trying to send the page no to a messageBox in the same Event like this:

xfa.host.messageBox(xfa.layout.page(this));

nothing happens. Why?

Regards

dpz

Accepted Solutions (0)

Answers (6)

Answers (6)

_Bruce_Robertson

MVP

05-03-2016

Hi,

Yes, having Acrobat makes debugging a lot easier, Ctrl-J will only work in Acrobat, but you should still be able to see the console in reader with the console.show() method.  There are a lot of JavaScript objects available in Reader that are not part of the XFA methods you get method completion support for in Designer, have a look at this link http://help.adobe.com/livedocs/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?h...

Regards

Bruce

dpz_

05-03-2016

I could remove the warnings:

- activating or deactivating of Acrobat JavaScript Console in not possible in target version. Targetversion Reader 10.0 Code 3302

- activating or deactivating of Acrobat JavaScript Debugger in not possible in target version. Targetversion Reader 10.0 Code 3301

by setting Target Version to 10 or higher in form preferences.

But still no console available 😞 Do i need Adobe Reader Pro?

dpz_

05-03-2016

Thanks for your answer. toString() works with messageBox.

I would like to use the console too.

I am Using LiveCycle Designer 11.0.1.20150701.2.920171 and Adobe Reader DC 15.010.20059. I Enabled Console for Javascript for Messages in the Reader. But when i hit CTRL + J in Reader nothing happens.

In LiveCycle Designer i get these warnings:

- activating or deactivating of Acrobat JavaScript Console in not possible in target version. Targetversion Reader 10.0 Code 3302

- activating or deactivating of Acrobat JavaScript Debugger in not possible in target version. Targetversion Reader 10.0 Code 3301

It seems that i have issues with my adobe software. LiveCycle does not know the console keyword. When i type console. i do not get a selection of keywords to complete the command.

Any Idea?

Regards

dpz

_Bruce_Robertson

MVP

04-03-2016

Hi,

The messageBox() method takes a string, the XFA methods don't seem to convert types like you would expect in JavaScript, so try

xfa.host.messageBox(xfa.layout.page(this).toString());

This would have caused an exception,  "Argument mismatch in property or function argument", you should make sure you have "Show console on errors and messages" selected in Acrobat (under Edit... Preferences...JavaScript).

Also there is a console.println() method which might be easier to use than having to click on a lot of message boxes, use Ctrl-J to show the console (or the console.show() method).

Regards

Bruce