These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

undefined JavaScript error on form fields possibly because PDF not fully loaded?

mozman
Registered: Nov 18 2011
Posts: 8

I have a form that transfer content from one half to the other. Users enter values in the top half, move\scroll down the PDF (past the second half of the form) and then press a 'Collect' button that transfers values from the top half of the form to the bottom.
 
This mostly works well, however sometimes, for the same PDF, I get an undefined error on some of the fields. Other times is works perfectly.
 
I am presuming that the reason is that parts of the form have not been loaded properly (that is one reason why I put the 'Collect' button below the end of the bottom section at the end of the form). The PDFs could have quite a few pages.
 
I was just after some advice on how to force the PDF to be loaded fully, or is there some check I can do.
 
Of course I could be wrong in my assumption, and it could be something else
 
Any thoughts
 
Thanks
 
Grant

My Product Information:
Reader 10.1, Windows
maxwyss
Registered: Jul 25 2006
Posts: 255
How do you view the PDF? In Acrobat/Reader or in a web browser?

What exactly is the error message?

Do you also get JavaScript errors (for that, you should activate the Console in the JavaScript section of the Acrobat/Reader Preferences).

Max Wyss.

mozman
Registered: Nov 18 2011
Posts: 8
Sorry my mistake, the actual error is null

hcFieldToUpdate is null

Where hcFieldToUpdate is a field defined something like this

var hcFieldNameToUpdate="collectedquantity-" + hcFieldNameTitleID
var hcFieldToUpdate = this.getField(hcFieldNameToUpdate);
hcFieldToUpdate.value=fieldValue;

I have been experimenting and values for this.numFields tend to vary depending what I do in the PDF. The PDF has something like 500 fields

If I just open the PDF and say go straight to the end I get a field count of 70 or so, if I actually interact with the PDF and add values to fields and then get the field count I get a higher number

I tried a few things like programatically going to each page before executing my code but that didn't seem to make a difference

Thanks

Grant
maxwyss
Registered: Jul 25 2006
Posts: 255
Can you somehow make the file available. From the description, it is extremely difficult to make any diagnosis.

Max Wyss.

mozman
Registered: Nov 18 2011
Posts: 8
Thanks for the offer

http://www.mediafire.com/?or88ixsbbg7ftw7

On the second from last page there is a button called 'transfer to order form'. This takes content from the first half of the file (with the images) to the order form bit. When you press the button the boxes in the second half of the form will get populated. I have added in a few attempts to get this to work, like moving from each page before I attempt to collect the data (so you will see the scrollbar move).

One interesting thing is that if I manually set the view to 10% and then page down so that I have 'seen' each page and then press the button it works perfectly (the console tells me there are 700 odd fields and the form gets populated). I was trying to reproduce this behaviour in JavaScript. It does something but the screen doesn't update.

Any help would be appreciated

Thanks

Grant
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
And how was this PDF and form created?

The PDF does not appear to be created by Acrobat. The form fields do not appear in the Nav Field Panel. There are also other anomalies that appear in Acrobat.

I also get different results with different versions of Adobe Acrobat.

George Kaiser

mozman
Registered: Nov 18 2011
Posts: 8
I use rendering software to create the document (made by a company called Ecrion - http://www.ecrion.com/). This takes xml and xsl-fo (formatting objects) to create documents, in this case a PDF.

Thanks

Grant
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
Is that software generating the form fields as well or are you adding them with Acrobat?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
I can not see any scirpting within the PDF using Acrobat.

LiveCycle Designer does not recognize the PDF as being an editable form.

Maybe you should be contacting Ecrion Software.

George Kaiser

mozman
Registered: Nov 18 2011
Posts: 8
Thanks for the feedback

The complete PDF is generated through the software (PDF content and form).

I will query Ecrion about this (previously they have always been helpful). Am I right in thinking then that there is no reason why I should not be able to access all form fields without having have actually viewed each page.

Thanks

Grant