javascriptxmlpdfadobelivecycle

Preventing Column Numbers from Decrementing Upon Deletion


I am doing some work on PDF documents, which is a brand new realm to me. Right now I have a rather complex form that is nearing the final stages of design, but there is a requirement which is truly hanging me up.

Essentially, I have a set of consecutive columns within the form. The standard number of columns is 20, and those are all in the PDF by default. However, the user also has the option to add move columns if required to. The user can also delete the columns they add, in case they do not need them. The problem comes from when a new column is added, then a column is deleted and yet another column is added after that.

For example, if the user adds column 21 and 22, then they are put into the form and there are now 22 columns. The user then deletes column number 21 (or any other column in the PDF), so now there are 21 columns. If the user goes to add another column, then it should be numbered as 23 (per the requirements specified), but that is not what is happening. It is numbered as 22. Therefore, the PDF now has two columns numbered as 22.

An example of this happening

An example of this happening

PDF in the design view

PDF in the design view

It needs to be the case that if a user deletes a column, then the number for the next column will still be incremented. So, even if there are only 22 columns in this form, they would be numbered ...19, 20, 22, 23 (since 21 was deleted before). I have reviewed the XML to see if there is a variable which will let me manipulate the way the column numbers are incremented/decremented, but it does not appear so. A possible approach may be to add some Javascript into the form to control the variable. However, I hardly know where to even begin with that, or if that level of detail is even required.

Thank you for any assistance.


Solution

  • It ended up being an issue with accessing the global value which was being used to store the column number. I was declaring the global variable per Adobe's documentation and had added it under the path...

    File -> Form Properties -> Variables.

    It needs to be declared in the script file itself in order for LiveCycle to allow you to modify its value using a JavaScript function.