Copy link to clipboard
Copied
So, my situation is that I have several forms that have varying pricing based on a single number. For instance, we have a set of 6 different prices based on the number of hours a program lasts. Ideally, I would open the document, navigate to the form field titled "HoursPricing" and enter a value -- for starters lets say "3". After entering this value, the form would auto-fill the prices into the proper positions.
So visually it would look something like...
Hours Pricing: 3
Price1: 170
Price2: 210
Price3: 300
I have a separate spreadsheet with the price lists based on the hours pricing and am fine manually typing in each individual price but if I only had to do that once, then every subsequent time only have to type "3" to get that pricing profile to auto-populate it would make life super easy. It sounds a lot like an "If/Then" statement but I don't have enough experience with Acrobat to even begin to test any formulas I've seen online.
Maybe form fields aren't the best way to do it, or there isn't a way to set it up. Any thoughts are appreciated.
Copy link to clipboard
Copied
Form fields are the only way of doing it, and the code involved is not that complicated, really.
If you want all of the code to be located in one place then you can use the custom validation script of the Hours Pricing field.
The code would look something like this:
if (event.value==3) {
this.getField("Price1").value = 170;
this.getField("Price2").value = 210;
this.getField("Price3").value = 310;
} else if (event.value==5) {
this.getField("Price1").value = 190;
this.getField("Price2").value = 230;
this.getField("Price3").value = 350;
// etc.
} else {
this.getField("Price1").value = 0;
this.getField("Price2").value = 0;
this.getField("Price3").value = 0;
}
It's also possible to do it with the data file itself, but that would require a much more complex script.
Copy link to clipboard
Copied
Okay, awesome!
Forgive my ignorance, but would this be put in the javascript debugger window?
Copy link to clipboard
Copied
Actually found where to put the code and it's working like a dream.
One other question, though. Can you put a character in with where the Value would be like...
Copy link to clipboard
Copied
The value should only be the number. The currency symbol should be added by
setting the correct Format option.
Copy link to clipboard
Copied
Thanks!! Working great!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now