Copy link to clipboard
Copied
First of all I'm very new to javascript and don't really know what I'm doing so apologies in advance. I want to set a button in an Acrobat form to adjust it's height according to the value it takes from another field. Is this possible? Thanks.
You should examine how this example works:
https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:d72fc67d-9788-40f4-b939-ee9638d3503a
(edited)
Copy link to clipboard
Copied
What units does you use? Inches, m, or ...?
Copy link to clipboard
Copied
Yes, it is. You can use the field's Validation or Calculation events to change the size of the button by setting its rect property. You'll need to provide a more clear description of the relation between the value and the height of the button field for additional help with the code.
Copy link to clipboard
Copied
Thanks so much guys. So I have three text fields which I have set to calcuate how many radio buttons are checked for Choice 1, Choice 2 and Choice 3 in a set of questions. The values returned can be between 0 and 20 (ie the question set has 20 questions). I then have three other fields which I've made into buttons, even though they won't do anything, purely so they don't have any actual text content etc. I want to click another 'calculate' button which will gather the three text field values and tell the three buttons to set themselves to those heights in millimetres. So if the text values returned were 5 for Choice 1 (text1), 10 for Choice 2 (text2) and 5 for Choice 3 (text3) the three buttons would change to 5mm high, 10mm high and 5mm high respectively. Hope this makes sense! Thanks again.
Copy link to clipboard
Copied
I see. You want to create a kind of bar chart. This is possible, but not so simple.
You would need to hard-code into the script the default position of the field and then calculate its new rect based on the value, but expressed in PostScript Points instead of millimeters. I would recommend reading the documentation of the rect property of the Field object to see how this can be done.
Copy link to clipboard
Copied
Yes I guess a bar chart is the kind of thing I'm after - a visual representation of a tally of what's been selected, but maybe this is beyond me. I'll have a read up on the rect property of the Field Object as you recommend. Thanks very much for your help 🙂
Copy link to clipboard
Copied
I've actually developed a (paid-for) script that does something very similar, only horizontally instead of vertically. You can find it here: https://www.try67.com/tool/acrobat-convert-percentage-fields-to-a-progress-bar
I've also created custom-made tools for my clients that do pretty much what you've described, so if you're interested I'd be happy to create one for you too (for a fee, of course). You can contact me privately via [try6767 at gmail.com] to discuss it further.
Copy link to clipboard
Copied
This tool looks great and may indeed do the job - thanks so much!
Copy link to clipboard
Copied
You can create buttons with different heights and show / hide the buttons.
Copy link to clipboard
Copied
ooo - a bit labour intensive (I actually have 5 question sets!!) but I like it as something I might actually be able to figure out and make work! Thanks 🙂
Copy link to clipboard
Copied
You should examine how this example works:
https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:d72fc67d-9788-40f4-b939-ee9638d3503a
(edited)
Copy link to clipboard
Copied
Thanks although the link says the files have been moved or I don't have access?
Copy link to clipboard
Copied
Sorry.
I modified the link above: https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:d72fc67d-9788-40f4-b939-ee9638d3503a
Copy link to clipboard
Copied
This is super useful - thank you so much 🙂