Bad I9 PDF form
Have been needing to programmatically fill out an I9 PDF, retrieved from gov site. Should be fairly straightforward, right?
Well… the field names are… a mess.
Field names like
topmostSubform[0].Page1[0].U\.S\._Social_Security_Number__Last_4_numbers_[0]topmostSubform[0].Page1[0].expiration_date__if_applicable__mm_dd_yyyy[0] topmostSubform[0].Page2[0].Employers_Business_or_Organization_Address_Street_Number_and_Name[0]
and so on make it pretty… not straightforward to create a usable key/value combination to search and replace.
But… today, I noticed it got better. Every state address I entered was ‘wrong’. We had a number of PDFs with ‘PR’ in them, when the state supplied is ‘SC’.
Digging further, the internal definition of the ‘state’ fields look like this
/TU (Section 1., Select State from the drop down list.)
/Opt [[( ) ( )] [(AL) (AK)] [(AK) (AL)] [(AZ) (AR)] [(AR) (AS)] [(CA) (AZ)] [(CO) (CA)] [(CT) (CO)] [(DE) (CT)] [(FL) (DC)] [(GA) (DE)] [(GU) (FL)] [(HI) (GA)] [(IA) (GU)] [(ID) (HI)] [(IL) (IA)] [(IN) (ID)] [(KS) (IL)] [(KY) (IN)] [(LA) (KS)] [(MA) (KY)] [(MD) (LA)] [(ME) (MA)] [(MI) (MD)] [(MN) (ME)] [(MO) (MI)] [(MP) (MN)] [(MS) (MO)] [(MT) (MP)] [(NC) (MS)] [(ND) (MT)] [(NE) (NC)] [(NH) (ND)] [(NJ) (NE)] [(NM) (NH)] [(NV) (NJ)] [(NY) (NM)] [(OH) (NV)] [(OK) (NY)] [(OR) (OH)] [(PA) (OK)] [(PR) (OR)] [(RI) (PA)] [(SC) (PR)] [(SD) (RI)] [(TN) (SC)] [(TX) (SD)] [(UT) (TN)] [(VA) (TX)] [(VI) (UT)] [(VT) (VA)] [(WA) (VI)] [(WI) (VT)] [(WV) (WA)] [(WY) (WI)] [(CAN) (WV)] [(MEX) (WY)] [(0) (CAN)] [(1) (MEX)]]
The ‘/Opt’ defines an option list, and each pairing is a display value and an actual value.
Setting the actual value to ‘SC’ – you can see that ‘PR’ is paired with ‘SC’, and we get ‘PR’ shown in every state field.
This is simply broken, as far as I can tell, and has been for years (since 2019?)
If someone can point me to how this is supposed to be used… feel free to email or call me.