Hi when a form created contains greater than 424+/- fields, calling the following javascript appears to possibly max out at 424+/-. Is this a bug? If so, is there a fix or another way to get the correct fields count until the fix is in?
ActiveX Viewer Pro SDK 4.0 (Nov. 25, 2008 Edition).
Form generated in Adobe 9.0.
There are 476 fields but "this.numFields" returns only 424 as count.
Windows XP, Service Pack 2
4 GB RAM
Thanks.
javascript for numFields may give wrong count when >424+/-?
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 25
- Joined: Tue Nov 11, 2008 12:04 am
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: javascript for numFields may give wrong count when >424+/-?
Can you send me your document with this form? You can use Ivan@tracker-software.com to send it.
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 25
- Joined: Tue Nov 11, 2008 12:04 am
Re: javascript for numFields may give wrong count when >424+/-?
Form sent. Thanks.
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: javascript for numFields may give wrong count when >424+/-?
As I see, Adobe Acrobat says that there are 424 fields too.
Why do you think that there are more ?
Why do you think that there are more ?
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 25
- Joined: Tue Nov 11, 2008 12:04 am
Re: javascript for numFields may give wrong count when >424+/-?
To get around the "this.numFields" issue I did the following to interate through all the fields via indexing. At the end, the index count was 477. In addition, I outputted the field names into and file and was able to see all my fields in the workaround but was not able to see it if I had iterated using the "this.numFields" returned value [ie. the fields with index beyond 424]. Thanks:
int nIndex=0;
std::string sFieldName="";
std::string sFieldValue="";
while((sFieldName=MPDFGetFieldName(nIndex))!="")
{
std::string sFieldName=MPDFGetFieldName(nIndex);
std::string sFieldValue=MPDFGetFieldValue(nIndex);
//...//
nIndex++;
}
//MPDFGetFieldValue
std::string MPDFGetFieldValue(long lFieldNum)
{
std::string sRetVal="";
try{
if(IsWindow(m_cPDFView.m_hWnd))
{
char szInput[256];
sprintf(szInput, "this.getField(this.getNthFieldName(%i)).value", lFieldNum);
_bstr_t sInput;
sInput=szInput;
_bstr_t sResult;
sResult="";
m_cPDFView.RunJavaScript(sInput, sResult.GetAddress(), 0, 0);
sRetVal=(char*) sResult;
}
}
catch(...)
{
sRetVal="";
}
return sRetVal;
}
Thanks.
int nIndex=0;
std::string sFieldName="";
std::string sFieldValue="";
while((sFieldName=MPDFGetFieldName(nIndex))!="")
{
std::string sFieldName=MPDFGetFieldName(nIndex);
std::string sFieldValue=MPDFGetFieldValue(nIndex);
//...//
nIndex++;
}
//MPDFGetFieldValue
std::string MPDFGetFieldValue(long lFieldNum)
{
std::string sRetVal="";
try{
if(IsWindow(m_cPDFView.m_hWnd))
{
char szInput[256];
sprintf(szInput, "this.getField(this.getNthFieldName(%i)).value", lFieldNum);
_bstr_t sInput;
sInput=szInput;
_bstr_t sResult;
sResult="";
m_cPDFView.RunJavaScript(sInput, sResult.GetAddress(), 0, 0);
sRetVal=(char*) sResult;
}
}
catch(...)
{
sRetVal="";
}
return sRetVal;
}
Thanks.
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: javascript for numFields may give wrong count when >424+/-?
Looks like I have found where the problem is: not in the numFields property, but in the getNthFieldName function.
A Fix will be available soon in a new build of the viewer.
A Fix will be available soon in a new build of the viewer.
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 25
- Joined: Tue Nov 11, 2008 12:04 am
Re: javascript for numFields may give wrong count when >424+/-?
Fantastic! Thanks.
Do you know when we can expect the new build?
Thanks.
Do you know when we can expect the new build?
Thanks.
-
- Site Admin
- Posts: 5223
- Joined: Tue Jun 29, 2004 10:34 am
Re: javascript for numFields may give wrong count when >424+/-?
Within the next 10 days - barring any unforseen issues.
Thanks for your patience.
Thanks for your patience.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com