Okay, I just came across a very strange phenomenon and I'm hoping someone can shed some light on it (or point out some obvious thing I'm missing :) ). I'm working on a rating form that has 11 numbered items wrapped in subforms. The subforms are rating[0] - rating[10].
Because LCD doesn't have an autonumbering feature, I created one using floating fields. Each rating subform has a description, and each description contains the floating field. In hierarchy view, it looks like this:
rating[0] //subform
autonum //floating field
desc //description field
comments
rating[1] //subform
autonum //floating field
desc //description field
comments
... etc., up to rating [10].
The autonum field contains this code to compute the correct item number:
$ = $.parent.index + 1 //adding 1 required because indexes are 0-based
Here's the bizarre thing. It works fine up to rating[8], where the autonum field displays "9" just as it should. However, the autonum fields inside rating[9] and rating[10] both display "0" instead of "10" and "11". So I messageboxed the name of the parents... and for the autonum field inside rating[8], the parent is rating[8], just as it should be... but for the autonum field inside rating[9], the name of the parent comes up as its own name...autonum!! Same thing for rating[10]. That explains the 0, but why aren't the parents showing up as rating[9] and rating[10] respectively? The subforms are structured identically.
Does anyone know if there is an LCD bug with index numbers 9 and above? Or does LCD insert a hidden node if an index number goes above 9? Any ideas how to compensate (other than hard coding the item number, which is exactly what I want to avoid? :) )
Thanks in advance--
Kathryn
What event are you placing the script on? Try placing it in the initialization event. Also make sure that your hierarchy and subform names are correct.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script