2 Replies Latest reply on Sep 10, 2008 1:48 AM by (Colin_Hackett)

Populate field, based on result of another field

Hi,

I'm really new to this, so would like replies to be as simple as possible :)

I have a field [TotalDays] and would like to populate a field called [DailyRate] with data from other fields [Rate1], [Rate2], [Rate3] or [Rate4] based on the result in [TotalDays].

Example:
[TotalDays] = 5
[Rate1] = \$10.00 (if days are 1-7)
[Rate2] = \$ 7.00 (if days are 8-21)
[Rate3] = \$ 5.00 (if days are 22-30)
[Rate4] = \$ 3.00 (if days are 31+)

Therefore [DailyRate] would populate with the amount \$10.00

I hope this makes sense???

Greg
• 1. Re: Populate field, based on result of another field
Hi Greg,

http://www.acrobatusers.com/tutorials/2007/js_list_combo_livecycle/

There is an exaple PDF for download so you can examine the code to see how it is done.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
• 2. Re: Populate field, based on result of another field
Greg, not sure if you ever got this resolved, but I have done this before using the following in the custom calc box of the 'dailyrate' field:

var r1 = this.getField("rate1");
var r2 = this.getField("rate2");

if ((this.getField("totaldays").value >= 1) && (this.getField("totaldays").value <= 7))

event.value = r1.value;

if ((this.getField("totaldays").value >= 8) && (this.getField("totaldays").value <= 21))

event.value = r2.value;

etc.

Hope this helps