Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Create an image insert button in a pdf form that clears once the user hits a submit form or reset form button?

New Here ,
Oct 04, 2016 Oct 04, 2016

I am updating a company form that was originally created in Livecycle Designer, by a user who has left the company, which had an attach image button.  The company purchased acrobat pro dc for me, thinking that I would be able to update the form, however it is not able to be edited and so I re-created the form in pro dc.

I can have the user insert a PDF image using the javascript

event.target.buttonImportIcon();

However not being a javascript familiar, and still learning acrobat, this is as far as I can get in the previous forums before I get lost.

The javascript works fine to get the image, however doesn't clear once the reset form or submit form buttons are used.

Can anyone please give me simple and clear instructions on how to do this?

P.S.  Adobe website does not mention anything about not being able to edit livecycle designer forms in other versions of acrobat, so I am already very frustrated.  Therefore please make replies newby friendly.

TOPICS
Acrobat SDK and JavaScript , Windows
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 05, 2016 Oct 05, 2016

You can't clear it directly. What you can do is a kind of a hack, which is to copy the icon of a button that has no icon applied to it.

So you create an image button (it can be hidden), set it to have an icon, but then don't actually select one.

When you want to reset your other button you can use this code:

this.getField("Image1").buttonSetIcon(this.getField("EmptyImage").buttonGetIcon());

Translate
Community Expert ,
Oct 05, 2016 Oct 05, 2016

You can't clear it directly. What you can do is a kind of a hack, which is to copy the icon of a button that has no icon applied to it.

So you create an image button (it can be hidden), set it to have an icon, but then don't actually select one.

When you want to reset your other button you can use this code:

this.getField("Image1").buttonSetIcon(this.getField("EmptyImage").buttonGetIcon());

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2016 Oct 05, 2016

Thankyou try67, but I'm still a little confused, sorry.

I create my button "image1" which I set to run the javascript; event.target.buttonImportIcon();

Do I then need to create a "EmptyImage" button which is hidden, and then I need my "ResetForm" button to run the javascript you suggest?

If it is something different to this, can you please step me through it, as this doesn't work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2016 Oct 05, 2016

Yes, that's pretty much it.

On Wed, Oct 5, 2016 at 11:50 PM, warrick_lee <forums_noreply@adobe.com>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2016 Oct 05, 2016

Ok, I am obviously missing something then, because I can't get it to work.

I've got my get image button "Image1" which is set to icon only, action mouse up, run a javascript - event.target.buttonImportIcon();

I've created a hidden button "EmptyImage", which is set to icon only, Behavior none, no label, or icon, no actions

I've create my reset form button "reset", which is set to label only, action mouse up, reset a form and run a javascript - this.getField("Image1").buttonSetIcon(this.getField("EmptyImage").buttonGetIcon());

However this doesn't work for me, what am I missing?

Thanks in advance

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2016 Oct 05, 2016

It's working fine for me... Are there any error messages in the JS Console when you run this code?

Can you share the file in question (via Dropbox, Google Drive, etc.)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2016 Oct 05, 2016

Dropbox - 8441910 Iss6 - UltraQ_UQReflex PAF_v4.pdf

There isn't any errors.

I'm testing the form using Reader DC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 05, 2016 Oct 05, 2016

There is an error for me and it indicates that you have the field name wrong. The name of the button is "Image 1", not "Image1".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2016 Oct 05, 2016
LATEST

Thanks George, and thanks Try67.  Can't believe I missed that typo.

Thanks so much for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines