Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Auto Popluate Fields

Avatar

Level 1

I had created a pdf in Acrobat Pro which has a 'drop down list' that, upon selection, auto populates multiple fields.  I accomplished this by using addition the following under "Custom Keystroke Script":

if( event.willCommit )
{
   if(event.value == " ")
     this.resetForm(["field1", "field2", "field3",]);
   else
     SetFieldValues(event.value);
}

Then in the javascript "SetFieldValues" I added:

var Data = { "selection1" :{ field1:  "item1",

                                           field 2: "item2",

                                           field 3: "item 3"},

                     "selection2" :{ field1: "item4",

                                          field2: "item5",

                                          field3: "item6"}};


function SetFieldValues(ctrl)
{
  this.getField("field1").value = Data[ctrl].field1;
  this.getField("field2").value = Data[ctrl].field2;

  this.getField("field3").value = Data[ctrl].field3;

}

This all worked wonderfully; however, I wanted to add a pop-up calendar on the date field so I decided to use LiveCycle Designer ES 8.2.  Now my auto-population does not work.  Is there any suggestions on how I can set it to have both working correctly?  I need the auto popluation fields (based on a single drop down menu) but would prefer to keep the calendar too...

Let me know if you have any thought, or is this not possible,

Thanks,

kbandstra

Message was edited by: kbandstra

1 Reply

Avatar

Level 10

Hi,

Forms created in Acrobat (AcroForms) are completely different to forms created in LiveCycle Designer (XFA Forms). The Javascript syntax is also differen, so you can't mix and match, without having to rescript your objects.

When in LC Designer you can add a date field, which has an inbuilt popup calendar. When in Acrobat, this object is not available.

You probably have two choices:

(1) move your form completely over to LC Designer, which would meant that you would have to change all of your existing script to Javascript that it compatible with LC Designer (or to FormCalc). For example:

      this.getField("field1").value = Data[ctrl].field1;

would look somrthing like:

      field1.rawValue = Data[ctrl].field1.rawValue;

You can access AcroForm objects by preceeding the script with "event.target."; e.g. event.target.this.getField(field1)...

(2) leave your form in Acrobat and following examples on the web for creating a popup calendar (http://www.acrobatusers.com/tutorials/2006/date_time_part2 - free and http://www.pdfscripting.com - paid subscription service).

Good luck,

Niall