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

Stopping the calculation of a QR code

New Here ,
Sep 16, 2020 Sep 16, 2020

Copy link to clipboard

Copied

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];
}
}
}

TOPICS
Acrobat SDK and JavaScript

Views

617

Translate

Translate

Report

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
Community Expert ,
Sep 16, 2020 Sep 16, 2020

Copy link to clipboard

Copied

Info: flattenPages flattens all form fields.

Votes

Translate

Translate

Report

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
New Here ,
Sep 17, 2020 Sep 17, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Community Expert ,
Sep 17, 2020 Sep 17, 2020

Copy link to clipboard

Copied

In your script you use flattenPages.

Votes

Translate

Translate

Report

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
New Here ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

Bernd:

I understand that. My issue is I only want to flatten a select few, which I can do, while leaving the rest fillable for my user. I am trying to focus on just the QR code field to stop it from calculating. As once I enter data in a user fillable field it autocalculates. 

 

I am seeking assistance on flattening the QR code field specifically.

 

Thank you.

Votes

Translate

Translate

Report

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
Community Expert ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

You can remove the calculation script.

Votes

Translate

Translate

Report

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
New Here ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

Bernd:

I am really new at this. Could you expand a bit, perhaps a lotta bit. The only way I have the code I attached is my perservance of searching the web; please dont misinterpret my coding capability. Thank you!

 

Mari

Votes

Translate

Translate

Report

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 ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

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)?

Votes

Translate

Translate

Report

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
New Here ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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
New Here ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

Perhaps I should back. How would I know it is flattened? Does it look different? I am not trying to be smart; your question made it dawn on me I may not know what I am looking for. 

 

I receive no console errors after I select the 'lock down completed fields' button. and my fields are flatten. The employee information fields are flattened with the emergency contact information to be completed after the QR codes are flattened.

Mari5E6E_0-1602533099130.png

 

Votes

Translate

Translate

Report

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
New Here ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

LATEST

George:

I was able to work it all out. thank you for your assistance.

 

Mari

Votes

Translate

Translate

Report

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