Skip to main content
Participating Frequently
September 17, 2020
Question

Stopping the calculation of a QR code

  • September 17, 2020
  • 2 replies
  • 1103 views

Greetings:

I am working on an employee on-boarding packet with fillable fields and QR codes for scanning into our document managemet system.

  • I have a seed page that captures name, address, etc of the new employee (completed by the HR Representative). These fields are repeated throughout the document and autopopulate becuase I use the same field names for each field; ie I have 3 FirstName fields, 3 LastName fields, etc..
  • Information from the seed page is used to calculate QR codes with metadata for ultimate scanning into our document management system.
  • Once the seed data is complete, I selectively flatten (the HR representative selects a button which performs the function) the repeating fields throughout the document so they can not be modified further. I also, or so I thought, flattened my QR codes, so it would maintain the image first created.
    • I thought I had flattened the QR code as I included the field name in my list of fields to be flattened.
  • As soon as my new employee types in anything the QR code changes back to its original state as the data from the seed page no longer exists since it is in a flattened state.

 

My goal is to stop the QR code from recalculating once the seed data is complete and the fields are flattened. Once flattened, the document is turned over to the new employee to complete filling it out.

 

I have included a list of my code. I took out some of the 'fields to be flattened' so it wouldnt be quite so long. I appreciate any assistance.

 

Thanks M

___________

var list = new Array();
list = [ //fields to be flattened
"TodaysDate",
"EmployeeID",
"SSN",
"Last4SSN",
"First",
"Middle",
"Last",
"PrefName",
"SiteLocation",
"HireDate",
"StreetAddress",
"StreetCity",
"StreetState",
"StreetZip",
"QR_HealthInsSel",
"QR_STSIGEnroll",
"QR_HRA_HSASel",
"QR_COBRA",
"QR_HepB",
"QR_DirectDep",
"QR_DeferredPay",
"QR_W4",

];

var fields = new Array;
for (var i = 0; i < this.numFields; i++) {
fields[i] = [
this.getNthFieldName(i),
this.getField(this.getNthFieldName(i)).display
];
this.getField(fields[i][0]).display = display.noPrint;
}

for (var i = 0; i < list.length; i++) {
this.getField(list[i]).display = display.visible;
}

this.flattenPages({
nStart: 0,
nEnd: this.numPages - 1,
nNonPrint: 1,
});

for (var i = 0; i < this.numFields; i++) {
for (var j = 0; j < fields.length; j++) {
if (fields[j][0] == this.getNthFieldName(i)) {
this.getField(this.getNthFieldName(i)).display = fields[j][1];
}
}
}

This topic has been closed for replies.

2 replies

Inspiring
September 28, 2020

It would be worth troubleshooting this to find out why certain fields are not getting flattened. I don't see anything in the code that would prevent it, and I am able to flatten bar code fields without a problem. Are there any errors shown in the JavaScript console (Ctrl+J)?

Mari5E6EAuthor
Participating Frequently
October 12, 2020

George:

Thank you so much for your response. I was able to circle back around to this challenge of mine.

I am getting an error code on the console that I am hoping you may have some insight.

  • i can complete the seed information on page one
  • the seed information feeds the QR code details for its calculation. The code includes fixed and variable components; with the variable portions populated by the seed document.
  • I then select the 'lock down completed fields which locks down all of the seed fields that are repeated within the document.
  • At this point the QR code still scans properly.
  • As soon as I continue completing the next set of fillable forms I throw the following error in the console
    • TypeError: this.getField(...) is null
      1:Field:Calculate
  • Also the variable components of my QR code loses the variable portions and only displays the fixed portion.

At this point my code is no longer valid which is why I think I am not flattening my QR code.

Any insight you can add would be great; thank you.

Mari

Inspiring
October 12, 2020

I would start by checking the console for errors immediately after you lock down the fields. If there are no errors, are any of the QR code fields getting flattened?

Bernd Alheit
Community Expert
September 17, 2020

Info: flattenPages flattens all form fields.

Mari5E6EAuthor
Participating Frequently
September 17, 2020

Bernd:

Thank you for your response. 

FlattenPages is not the correct command in this instance as I need to keep approximately 60% not only unflattened; I need them to be fillinable so my new EE can take the document over and finish completting it. The QR code is calculated with only the seed data initially collected.

 

Mari

Bernd Alheit
Community Expert
September 17, 2020

In your script you use flattenPages.