@Tilman I agree that setting an illegal option is the only bug here. The other issue is more a matter of convenience. In my case I'm mapping HTML form data to PDFs, to be precise: input from <select> fields to PDChoice / PDComboBox fields. Both fields can be single or multi-valued. Ideally, I would work transparently with lists here and only expect errors when I try to set more than one entry on a single-valued PDChoice.
@Maruan You're correct, that's what I was trying to ask. On 2021/08/17 06:05:18, "[email protected]" <[email protected]> wrote: > If I understand the question correctly it's about being able to use the > List based setter with a single select option field if the List has a > single entry. If the List has more than one entry still throw the > exception. > > Is that correct? > > BR > Maruan > > Am Dienstag, dem 17.08.2021 um 04:47 +0200 schrieb Tilman Hausherr: > > IMHO the only bug is that a setter can set an illegal option. > > > > The rest looks fine to me, a user should know what field they are > > filling. > > > > Tilman > > > > > > Am 16.08.2021 um 18:10 schrieb Oliver Degener: > > > Hi, > > > > > > I'm using PDFBox to automatically fill in all kinds of PDF > > > documents. Recently, I was seeing the following error message with > > > a new PDF: > > > 'The list box does not allow multiple selections.' > > > > > > I saw in the code that the PDChoice field can be single-select or > > > multi-select. With single-select fields, the setter that takes a > > > list of choices [0] throws an exception whenever the given list is > > > not empty. Therefore I now have to use the general setter from > > > PDField [1] which does not check whether the provided option is > > > valid (selectable). > > > > > > It would be great if the setter from [0] would also work for > > > single-select choices and would only throw an exception if the > > > list's size is greater than 1. > > > > > > Any thoughts on this? > > > > > > Thanks & Regards > > > Oliver > > > > > > [0] > > > https://pdfbox.apache.org/docs/2.0.3/javadocs/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.html#setValue(java.util.List) > > > [1] > > > https://pdfbox.apache.org/docs/2.0.3/javadocs/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.html#setValue(java.lang.String) > > > > > > ------------------------------------------------------------------- > > > -- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > -- > -- > Maruan Sahyoun > > FileAffairs GmbH > Josef-Schappe-Straße 21 > 40882 Ratingen > > Tel: +49 (2102) 89497 88 > Fax: +49 (2102) 89497 91 > [email protected] > www.fileaffairs.de > > Geschäftsführer: Maruan Sahyoun > Handelsregister: AG Düsseldorf, HRB 53837 > UST.-ID: DE248275827 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

