Copy link to clipboard
Copied
I was trying to mess around with maximum values within the fields of my Adobe Form document.
I learned how to do this through the validation tab in the text field properties, but I was trying to set it so that the maximum value for that field would be based on the value of another field, and potential the checking of a check box.
So for instance Field1 would have a maximum value of field2+2, and if a value higher than that would be entered text would appear that would say "The value cannot be higher than field2+2". Alternatively, if a certain checkbox were selected it would change the maximum value and the text would change to be field2+5, rather than field2+2.
I am unsure if any of this is even possible and if so, I clearly dont know how to make it happen, and any help is appreciated.
1 Correct answer
HI Rael,
Here's what I have:
- The numbers are in [FieldZ]
- A hidden field would yield the highest number in [FieldZ], and in my example is called [Max of FieldZ].
- Another field would be [[Max of FieldZ] + 2]. That field would add the highest value in FieldZ to 2.
- My syntax isn't right — just the theory.
Otherwise, JavaScript isn't that hard for calculations, even though I'm better at copy and paste.
In this example, you can see the two field names in the table. This code would go in the field for subtra
...Copy link to clipboard
Copied
Hi Rael,
Try doing a the calculation in a hidden field.
I'll call it FieldA, and FieldA would calculate Field 2+2.
Field 1 would then have a maximum value of the hidden FieldA.
I just kept reading though, and you want the "2" to be a variable. So that's in another field: FieldB and hidden Field A calculates Field2 + FieldB.
Am I following correctly?
Anyway, use hidden field for the intermediate calculations and come back if it doesn't work (and let us know if it does!)
You could also write JavaScript and do it that way.
~ Jane
Copy link to clipboard
Copied
Thanks for the response. I would definitely wanna avoid writing Java script unless it is the only way to get the job done.
But how do I make it have that maximum value of fieldA? I don't see anything that allows me to set a maximum value. I tried writing it into "Run custom validation script" but it doesn't seem to work the same as it does for making a field auto-calculate.
Copy link to clipboard
Copied
An Update:
From what I was just told with Adobe Chat Support, this can only be done with javascript. I have found some info online, but it is all people just writing javascript for specific functions and nothing about how to write the javascript so i have no clue how to apply it to my situation. It does seem the check box method can be done using javascript.
Copy link to clipboard
Copied
Hi Rael,
If the MAX function does not work, you may need JavaScript. We have a JavaScript forum, and I can move this thread or you can start a new question.
If you duplicated your fields and they have been renamed FieldA.1, FieldA.2, etc., then they are a family and you need to find the MAX of the family, which is FieldA. (I think that's the direction you are going in.)
All of the Acrobat forums are here: Acrobat and you will see the one that says JavaScript. I can write some JavaScript, but I really excel at copy and paste. You click Edit for the Custom Calculation Script, then paste into the next dialog. The general principle is that you define your variables, then say what you want it to do. It has to be plain text with straight quotes.
Jane
Copy link to clipboard
Copied
I get what you were suggesting now. I've definitely used that method before, but I don't want it to auto calculate. I want it to allow someone to enter a number, but that that number cant be greater than the other field +2, not just that it would calculate to be the maximum of the two.
Thanks for all of your help. I will simply make this a new question with the javascript section.
Copy link to clipboard
Copied
HI Rael,
Here's what I have:
- The numbers are in [FieldZ]
- A hidden field would yield the highest number in [FieldZ], and in my example is called [Max of FieldZ].
- Another field would be [[Max of FieldZ] + 2]. That field would add the highest value in FieldZ to 2.
- My syntax isn't right — just the theory.
Otherwise, JavaScript isn't that hard for calculations, even though I'm better at copy and paste.
In this example, you can see the two field names in the table. This code would go in the field for subtract in the Custom Calculation Script. First the variables are defined, then comes the math.
![](/skins/images/E3E4AFE003C95F0FF3D8EDFF67AF85D5/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/E3E4AFE003C95F0FF3D8EDFF67AF85D5/responsive_peak/images/icon_anonymous_message.png)