Copy link to clipboard
Copied
Okay, here is my situation. I want to create a button that is interactive, but in a simple way. Thanks to other forums, here's what I have done so far. Go to Forms, Add button, size it and Save. Then go to properties/Actions/Run A Javascript/Add and put input: if (app.viewerVersion < 11) etc.... OK then I go to Tools, Javascript/Document Javascript and put in my script. Thanks to all in previous chats. All of that works well. The only one thing, I need now that will make it perfect, is to be able to preview the pdf/jpeg that I attachment as a small image as well as an attachment. Now I did however find a way to do it using this: ( event.target.buttonImportFile();) but the only problem is that particular script attached to the button, causes the browse file search, to open twice to do 1 file. Once to lock in the icon, then a 2nd time to attach the file. So is there anyway to insert a script, in the open javascript button that will save the mini-image on the button and save the attachment together as one? Any help would be GREATLY appreciated. See illustration for further details.
Copy link to clipboard
Copied
It should only take one selection. What exact code did you use?
And no, JS can't be used to display a preview thumbnail of the selected image. That's up to the application and/or the OS's file selection dialog.
Copy link to clipboard
Copied
Hi Try 67, I must have found something, new. As you see in the pic, my button does have a thumbnail . As stated above I use 2 javascript entries. The first one is clicking on the button, and under javascript I input the 1st script and the 2nd java entry is under the Document Javascripts Toolbox. See Attached forms for a more detailed explanation. Thanks.
Copy link to clipboard
Copied
You'll need to share the file for further help, but from what I can see you've duplicated the code for selecting the image. It's very unlikely the file will be used in a version prior to XI, so you don't need the whole pre/post_11 functions. Keep just the first line of code, using buttonImportIcon.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Like I said, keep just the first line and try it again.
Copy link to clipboard
Copied
I assuming you are referring to the 1st Javascript line, under Run a javascript?
which is: event.target.buttonImportIcon();
I did just keep this. It loads the thumbnail but does not load the file. That defeats the purpose. When I view attachments, nothing has uploaded. Unless I am missing something, that don't work. Any other ideas?
Copy link to clipboard
Copied
The image is imported fine for me. The preview for it can be seen in the OS dialog, if you have that option enabled.
Copy link to clipboard
Copied
To add attachments use the functions import_pre_11() or import_11()
Copy link to clipboard
Copied
Somehow I must not be understanding what you are referring to. When trying to do this, that does not work. See attachment below. Tell me what I am doing wrong here.
Copy link to clipboard
Copied
Using the: import_11(); Command works but back to the same problem. I have to select my file twice, instead of once for thumbnail and then again for file attachment. I need one click and done.
Copy link to clipboard
Copied
The attachment works for me.
Copy link to clipboard
Copied
Which attachment exactly? And can you give me the exact way you are inputing it?
Copy link to clipboard
Copied
It let me attach every file.
Copy link to clipboard
Copied
Thanks, for your response. I need anyone else who can show me what they are putting in the script, so I can see where my error is. As stated before, mine is not working the way I am inputing it in. My other help would be appreciated.