Yep, you found a bug. Have a look at line 2101 through 2120 here:
http://itext.svn.sourceforge.net/viewvc/itext/trunk/src/com/lowagie/text/pdf/AcroFields.java?view=markup
You'll see that the function only modifies the first entry in
AcroFields.Item.[merged/widget/values]. To handle your case, it would have
to enumerate each of those arrays.
Suggestion: Write up a patched version that can replace some or all fields
with the same name, and submit it. Something like:
/***DANGER: CODE WRITTEN IN EMAIL EDITOR AHEAD***/
public boolean replacePushbuttonField(String field, PdfFormField button) {
return replacePushButtonField( field, button, 0 ); // maintain old
behavior
}
// new version, containing most of the old function
public boolean replacePushbuttonField(String field, PdfFormField button, int
replaceIndex) {
if (replaceIndex == -1) {
/*change them all*/
} else {
/* change the specified button */
}
}
Mark Storer
Senior Software Engineer
Cardiff.com
#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;
On 11/2/07, iy <[EMAIL PROTECTED]> wrote:
>
>
> I have a PDF with two submit buttons with the same field name. I am using
> AcroField replacePushButtonField() to set the submit URL at run time. But
> it seems to replace the first submit button only. Is this a bug? how do
> I
> get around that? I tried renaming one of the submit button to a different
> name, but it seems the method renames all fields of the same name, so that
> doesn't help. The two buttons are on the same page.
> --
> View this message in context: http://www.nabble.com/replaceP
> ushButtonField-doesn%27t-work-on-fields-with-the-same-name--
> tf4737381.html#a13547490
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
--
--Mark Storer
Professional Geek
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/