I am using a pdf created with Adobe Designer 7.0...

When calling setListOption with a shortened (non-key) field name, the
method fails with a nullpointer exception on the Item.  Is there a
reason that the fieldName parameter that works for setField doesn't work
here?

public boolean setListOption(String fieldName, String[] exportValues,
String[] displayValues) {
        if (exportValues == null && displayValues == null)
            return false;
        if (exportValues != null && displayValues != null &&
exportValues.length != displayValues.length)
            throw new IllegalArgumentException("The export and the
display array must have the same size.");
        int ftype = getFieldType(fieldName);
        if (ftype != FIELD_TYPE_COMBO && ftype != FIELD_TYPE_LIST)
            return false;
        Item fd = (Item)fields.get(fieldName); //--nullpointer here for
valid field name, expects the .whatever[0]. pathing

public boolean setListOption(String fieldName, String[] exportValues,
String[] displayValues) {
        if (exportValues == null && displayValues == null)
            return false;
        if (exportValues != null && displayValues != null &&
exportValues.length != displayValues.length)
            throw new IllegalArgumentException("The export and the
display array must have the same size.");
        int ftype = getFieldType(fieldName);
        if (ftype != FIELD_TYPE_COMBO && ftype != FIELD_TYPE_LIST)
            return false;

//(stole this code from setField method, which works)
        if (xfa.isXfaPresent()) {
            fieldName = xfa.findFieldName(fieldName, this);
            if (fieldName == null)
                return false;
            String shortName = XfaForm.Xml2Som.getShortName(fieldName);
        }
        Item fd = (Item)fields.get(fieldName); //--sets values correctly
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to