Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need to map field names to strings

Community Beginner ,
Apr 06, 2016 Apr 06, 2016

Hi All,

I have a PDF form with several sections on it. Each section captures information about a person for example Person1 might be a teacher, Person2 might be a student, Person3 might be a parent.

For each of these people the forms captures some information which is common to all of them like Name, Address, Phone, then depending on whether it is a student parent or teacher the are 3-4 other fields which depend on the type of person ie:

PDF FIELD NAMES

Person1 Teacher

TeacherName

TeacherSurname

TeacherAddress

TeacherDOB

TeacherPhone

Teacher ID number

Person2 Student

StudentName

StudentAddress

StudentDOB

StudentPhone

StudentSchool

Person2Parent

ParentName

ParentAddress

ParentDOB

ParentOccupation

ParentPhone

ParentEthnicity

Now a lot of the information for each person can be obtained from another application on the same system so I can copy, for example this information to the clipboard:

CLIPBOARD INFORMATION TO PARSE

Person Id: 1234567

(Name): BUGSY Malone

(Home Address) 123 Any Street

(DOB) 01/01/2000

(Phone) 555-123-4567

(Occupation) Truck Driver

(Race) European

I have written the parser function with regexp to grab this information as store each piece as a string and for the teacher section I have hardcoded

surname

firstname

id

address

ocupation

phone

What I now need is a way to call my parser function from any of the parent, student, or teacher fields, and have the code put the right information in the right place,even though sometimes the field names are slightly different, and sometimes there is not a field for a piece of information from the parser - like "Race"

Thanks in advance,

-Al

George_Johnson‌Geckoz100‌radzmar‌

TOPICS
Acrobat SDK and JavaScript
332
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 07, 2016 Apr 07, 2016
LATEST

With JavaScript one can determine if a field does not exist.. Just try to get the field object and if it returns a null Ithe field does not exist. If the field exist, then the field object is returned. You can use the JavaScript "typeof" statement to test what a variable is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines