Professional Web Applications Themes

Dynamically Activate Button via FDF - Adobe Acrobat Windows

I am generating an FDF file that calls a PDF with form fields and buttons. There are four buttons that I want to dynamically turn on or off depending on what I send from the FDF file. For example: <</T(Chairman)/V/On>> <</T(Master)/V/Off>> <</T(Leadership)/V/Off>> <</T(President)/V/Off>> Would turn the Chairman button on and the rest off. Does not work. Any clues from anyone? Thanks! RLS...

  1. #1

    Default Dynamically Activate Button via FDF

    I am generating an FDF file that calls a PDF with form fields and buttons.

    There are four buttons that I want to dynamically turn on or off depending on what I send from the FDF file. For example:

    <</T(Chairman)/V/On>>
    <</T(Master)/V/Off>>
    <</T(Leadership)/V/Off>>
    <</T(President)/V/Off>>

    Would turn the Chairman button on and the rest off.

    Does not work. Any clues from anyone?

    Thanks!
    RLS
    RandyLSmith@adobeforums.com Guest

  2. #2

    Default Re: Dynamically Activate Button via FDF

    Default all your buttons (radio i'm assuming) export value to "On" instead
    of "Yes". If "On" is the value for the button it will be
    selected...Otherwise it will not.

    --
    .................................................. .......
    Eljon Greene
    formGenie - E-Doents Simplified
    E-mail: com
    Website: www.form-genie.com
    .................................................. ....
    <com> wrote in message
    news:la2eafNXanI... 
    on what I send from the FDF file. For example: 


    E.G. Guest

  3. #3

    Default Re: Dynamically Activate Button via FDF



    Does not work.




    Are you taling about check boxes and/or radio buttons? If so, what have you defined for their export values?

    George
    George_Johnson@adobeforums.com Guest

  4. #4

    Default Re: Dynamically Activate Button via FDF

    George,

    These are neither check nor radio -- they are icon buttons. They show a certain logo based upon that person's certifications. For instance, in the realtor's world, they might have a President's Award, a Master's Award, a Leadership Award, or no award (leave the area blank).

    I have been examining the javascript tools. If I could get a javascript to run when the doent is opened, no problem (I think) but Adobe does not give the On Doent Load option! THey have javascript areas for when doc closes, prints, etc, but not when it loads.

    How do you make icons appear/disappear (set hidden true/false state) when the the PDF doc loads?

    Thanks!
    RLS
    RandyLSmith@adobeforums.com Guest

  5. #5

    Default Re: Dynamically Activate Button via FDF



    These are neither check nor radio -- they are icon buttons.




    I was confused because in the FDF you posted you were trying to set their value, but buttons do not have a value. In order to control the visibility of a button, you have to set the appropriate annotation flags for the field.

    Regarding an On Load event, any doent-level JavaScripts are loaded at the time the doent loads. Any code outside of a function definition is executed at this time. So although is doesn't have the name "On Load", this is where you'd place code that you want to execute when the PDF opens. However, for what you want to do, I would suggest manipulating the field flags. If you get stuck, post again.

    George
    George_Johnson@adobeforums.com Guest

  6. #6

    Default Re: Dynamically Activate Button via FDF

    Thank you, George, for giving me a direction. I thought the /On /Off flags would make a button/icon visible or not - now it looks like I need to get into flags and annotation! Oy.

    I put some javascript in the "display all javascript" area once. When I went back to look at it, it was gone! I have no idea where it went. That was rather confusing, making me think there's some other general on load type area.

    I'll keep digging.

    Thanks again!!
    RLS
    RandyLSmith@adobeforums.com Guest

  7. #7

    Default Re: Dynamically Activate Button via FDF



    I put some javascript in the "display all javascript" area once.




    I rarely use "Advanced > JavaScript> Edit All JavaScripts", but I frequently use "Advanced > JavaScript > Doent JavaScript". It's safer and more organized.

    George
    George_Johnson@adobeforums.com Guest

  8. #8

    Default Re: Dynamically Activate Button via FDF

    George,

    I have the following testing javascript in that area (doent) and tried it yesterday, but it doesn't seem to _execute_:

    function open()
    {
    Chairman.hidden = false
    President.hidden = true
    Leadership.hidden = true
    Master.hidden = false
    }

    How do I get it to execute when the doent loads? It makes you give it a name so I gave it open (bad choice, probably, but nonetheless...)

    RLS
    RandyLSmith@adobeforums.com Guest

  9. #9

    Default Re: Dynamically Activate Button via FDF

    Place the code outside of the function definition, as mentioned before. Note that you do not have to define any functions. The name you provide is the name of the doent-level JavaScript and Acrobat provides a function skeleton of the same name, which you are free to remove.

    George
    George_Johnson@adobeforums.com Guest

  10. #10

    Default Re: Dynamically Activate Button via FDF

    Okay, I removed the "function" portion (left the brackets in, but those can probably go as well) and put an app alert in and it works just fine that way ... as far as getting the app alert to pop up.

    The buttons aren't changing state, however. Perhaps I have the name wrong? or the flag? I've tried:

    Chairman.hidden = false;
    This.Chairman.hidden = false;
    This.Chairman.visible = false;

    Nothing. nada. Zilch.

    But I can see a problem coming down the road with this method anyhoo - how do you pass a button state into a pdf via an FDF file?

    RLS
    RandyLSmith@adobeforums.com Guest

  11. #11

    Default Re: Dynamically Activate Button via FDF

    You need to read up on the "getField" JavaScript method of the doent object. Here's a hint:

    this.getField("Chairman").display = display.visible;

    George
    George_Johnson@adobeforums.com Guest

  12. #12

    Default Re: Dynamically Activate Button via FDF



    how do you pass a button state into a pdf via an FDF file?




    I already told you. You need to specify the appropriate annotation flags for a field. The reference to consult is the PDF Reference Manual, somewhere at <http://partners.adobe.com> You'll want to read the section on annotation flags as well as the section on FDF. If you're using the FDF Toolkit to create the FDF, check out the FDFSetFlags method. If you get stuck, I can post a sample FDF.

    George
    George_Johnson@adobeforums.com Guest

  13. #13

    Default Re: Dynamically Activate Button via FDF

    Very strange.

    I didn't seem to be having any luck, so my final desperation attempt looks like this:

    var Chairm = this.getField("Chairman");
    var Presid = this.getField("President");
    var Leader = this.getField("Leadership");
    var Master = this.getField("Master");

    Chairm.display = hidden;
    Presid.display = false;
    Leader.display = 0;
    this.getField("Master").display = display.visible;

    app.alert("Houston, we have contact.",3,0);

    I noticed that it actually works -- until I hit "ok" on the app.alert screen that comes up, then the icons revert to the state they were set to in the saved PDF.

    Do I need to somehow issue a save of the PDF before it leaves this javascript series?

    And then the final problem rears it's head: how do I throw these display/ don't display switches from an FDF file? Is it even possible? Wish I could include the javascript in the FDF file that I generated!

    RLS

    Actually, there is one last "nuisance" problem: when you call an FDF from a web page, it opens a blank browser window, then calls the PDF in a new window, so a "preview" function from my web site opens two child windows that the customer has to close to get back to my app. Some days it seems like it never ends, eh?
    RandyLSmith@adobeforums.com Guest

  14. #14

    Default Re: Dynamically Activate Button via FDF



    then the icons revert to the state they were set to in the saved PDF.




    Then something else is changing them. You have to find what's causing this and disable it.

    Is it even possible? Wish I could include the javascript in the FDF file
    that I generated!




    Again, yes, but you don't need to use JavaScript. You just need to set the appropriate annotation flags for the fields in the FDF. This may not make sense to you until you read the relevant doentation referenced above.

    George
    George_Johnson@adobeforums.com Guest

  15. #15

    Default Re: Dynamically Activate Button via FDF

    Well, I've been all through the FDF Toolkit doentation, but didn't see anything that referenced setting states. It all looked like the <> type stuff. I'll look around again. Thank you for all your help - I'll keep digging!
    RandyLSmith@adobeforums.com Guest

  16. #16

    Default Re: Dynamically Activate Button via FDF



    Well, I've been all through the FDF Toolkit doentation




    Read up on the "FDFSetFlags" method of the FDF Toolkit. Note that you probably won't find any wording like "setting states" in the doentation that has to do with what you're trying to accomplish.

    George
    George_Johnson@adobeforums.com Guest

  17. #17

    Default Re: Dynamically Activate Button via FDF

    It appears that I am very close, but am having trouble with the syntax of the SetFf key. Does anyone know how it's supposed to look when in an FDF file?

    I've tried variations on:

    /T (fieldname) /SetFf/1

    but I think I'm missing a key element. I've been looking through all the Adobe docs I can get my hands on, and one said I need to affect bit 2 for hidden versus displayed. Just not quite sure of the syntax and haven't found a syntax doent yet that spells it out for FDf files (found'em for C, perl, etc though! Like that helps...)

    RLS
    RandyLSmith@adobeforums.com Guest

  18. #18

    Default Re: Dynamically Activate Button via FDF

    For controlling whether a field is hidden or visible, you don't want to mess with the field flags (/SetFf), but rather the annotation flags (/SetF). Both sets of flags are described in intimate detail in the PDF Reference Manual, as are the /SetF, /ClrF, /SetFf, and /ClrFf keys that are used in FDFs.

    George
    George_Johnson@adobeforums.com Guest

  19. #19

    Default Re: Dynamically Activate Button via FDF

    Okay, but I was close!

    Still, I just don't get it with their doentation. They never provide a real example of using it in an FDF.

    This is the last, final BIG thing I need to solve to finish this project; the double-browser-window is a nuisance, but it doesn't stop the show like this buttons on/off thing does.

    I understand the second bit affects the hidden state; I have yet to find a layout of all the bits, and whether it's a word, double-word, or what? sized layout. I guessing it's word, but they don't make it easy (or I've missed it somehow).

    All I need is this one last example. I think it's something along the lines of:

    /T (President) /SetF/2

    so I guess I'll have to just keep trying different combo's until I stumble upon the answer.

    THks- RLS
    RandyLSmith@adobeforums.com Guest

  20. #20

    Default Re: Dynamically Activate Button via FDF

    Success! This works to turn the buttons OFF. Default, which is the 0 (zero) below, leaves them as is, so leave them VISIBLE in the pdf. Hope this helps someone else with this problem, that of turning icons on/off in a PDF via FDF -- AND -- in making the pdf load in the same page as the FDF (can also use _self after Target, but it worked better for me to href to a new window named "showme" and then use that here as the target). Thanks again for all your help, George!

    %FDF-1.2
    1 0 obj
    <</FDF<</F (http://pdf.xyz.com/pdf/test20040628a.pdf) /Target (ShowMe) /Fields [ <>
    <>
    <>
    <>
    <>
    <>
    <>
    <>
    <>
     [/ref][/ref]
    trailer
    <>
    %%EOF

    RandyLSmith@adobeforums.com Guest

Page 1 of 2 12 LastLast

Similar Threads

  1. Dynamically showing button
    By colinwalton in forum Macromedia Dynamic HTML
    Replies: 2
    Last Post: February 19th, 09:31 AM
  2. Dynamically adding Dropdown, Text Box, Add Button and Remove Button
    By Rocky in forum ASP.NET Building Controls
    Replies: 1
    Last Post: November 19th, 07:35 AM
  3. Pass URL in button dynamically
    By lak25 in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: January 11th, 02:26 AM
  4. How do you activate a "COMMAND Button" with a macro?
    By RBB in forum Microsoft Access
    Replies: 3
    Last Post: July 7th, 04:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139