Interactive PDF with output based on numerical input
Copy link to clipboard
Copied
Hi, we are looking into creating an interactive PDF that allows users to find their product size based on physical measurements they just measured.
- The simple version is where a user fills in the measured dimension in a textbox, and based on the number, a size comes out. We envision this to be a checkmark icon next to a certain size that is already displayed. So for example: A user inputs 50 (cm) as an input, and a checkmark appears next to a text displaying 'Size M', as an output.
- The slightly more advanced version is where the output is based on two numerical inputs. So user inputs a first value, which narrows down the choices, and then a second value, which defines the output. So for example: there are 9 sizes: A user inputs 30 (cm) as a first input, which narrows the choices to 3 sizes, and then inputs 40 (cm) for as a second input, which defines the final size so a checkmark appears next to a text displaying 'Size S'.
Is Acrobat able to do these two? Can someone give we some pointer where to start? We have some general programming skills in-house.
Best regards,
Copy link to clipboard
Copied
Hi there
Hope you are doing well and thanks for reaching out.
The workflow that you are trying to achieve is might be possible using custom JavaScript.
For more information about using JavaScript please check the help pages listed below:
https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html
https://acrobatusers.com/tutorials/javascript_console/
Hope this information will help
Regards
Amal
Amal
Copy link to clipboard
Copied
> Is Acrobat able to do these two?
- Yes.
The former is easier to achieve than the latter, of course.
Let's say the "M" check-box is called "CheckBox M".
You can use the following code as the custom validation script of the text field:
var v = Number(event.value);
this.getField("CheckBox M").checkThisBox(0, v==50);
The latter would require a more complex script, that will have to take into account the values of both text fields, and enable/disable as well as tick/untick the check-boxes accordingly. It's especially tricky if you want the user to also be able to change the default selection in the check-boxes to something else.

