These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

ID Badge Form

AJMitchell
Registered: Dec 7 2011
Posts: 6
Answered

Sorry for the rather long post...
 
We're creating a PDF form for our organisation which will be used to create ID badges.
 
Managers will use it to enter the names of employees and various other details. The form will also be used for existing staff updating their details so a new badge can be provided - e.g. women changing their surname when they get married etc., and more rarely people changing their names.
 
There are 4 fields which relate to the problem we're having:
 
A1Forename
A1Surname
 
A1ForenameAmended
A1SurnameAmended
 
B1PrintFullName
  
The user will enter their names into fields A1Forename and A1Surname if they are a new start and also to tell us what name is currently on our system -if they are an existing employee who is changing their name.
 
Fields A1ForenameAmended and A1SurnameAmended have more importance than the previous fields (if completed) as they will contain the new names to replace the ones on the system.
 
B1PrintFullName is the field we need the calculation for.
  
What we're looking for
 
We'd like the B1PrintFullName field to show a concatenation of A1Forename and A1Surname as a default BUT if the user has entered details into A1ForenameAmended and A1SurnameAmended to INSTEAD show a concatenation of these fields.
 
Is this possible?
 
Many thanks for any help you can give
  

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Sure. There are a lot of ways to do it, though... Here's how I would do it.
Below is the custom calculation script for B1PrintFullName:
  1. var forenameAmended = getField("A1ForenameAmended").value;
  2. var surnameAmended = getField("A1SurnameAmended").value;
  3. if (forenameAmended!="" || surnameAmended!="") {
  4. event.value = forenameAmended + " " + surnameAmended;
  5. } else {
  6. var forename = getField("A1Forename").value;
  7. var surname = getField("A1Surname").value;
  8. event.value = forename + " " + surname;
  9. }

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

AJMitchell
Registered: Dec 7 2011
Posts: 6
Brilliant, just what we needed. Thanks for your help with this - much appreciated!

Andrew